shill: Convert code to use the newest version of libchrome.
The biggest change is a switch from using the deprecated
Task and CallbackN mechanisms to using the new Callback
mechanism.
Note: Original CL was https://gerrit.chromium.org/gerrit/16156.
This is logically another patch to that CL, but since the
latter was already merged, and is considered closed by
Gerrit, it's necessary to create a new CL.
BUG=chromium-os:15330
TEST=Build shill and run it on a zgb with a modem. Build and
run unit tests.
CQ-DEPEND=I37628863370323d30cac493764ea28f8ffd42637
Change-Id: I3ae78a3aa44ec167b79f2170d07650ece888254f
Reviewed-on: https://gerrit.chromium.org/gerrit/18030
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
Commit-Ready: Eric Shienbrood <ers@chromium.org>
diff --git a/cellular_capability_gsm.cc b/cellular_capability_gsm.cc
index c7cc8af..63ebbff 100644
--- a/cellular_capability_gsm.cc
+++ b/cellular_capability_gsm.cc
@@ -4,8 +4,9 @@
#include "shill/cellular_capability_gsm.h"
+#include <base/bind.h>
#include <base/logging.h>
-#include <base/stl_util-inl.h>
+#include <base/stl_util.h>
#include <base/string_number_conversions.h>
#include <base/stringprintf.h>
#include <chromeos/dbus/service_constants.h>
@@ -18,6 +19,7 @@
#include "shill/property_accessor.h"
#include "shill/proxy_factory.h"
+using base::Bind;
using std::string;
namespace shill {
@@ -43,7 +45,7 @@
CellularCapabilityGSM::CellularCapabilityGSM(Cellular *cellular,
ProxyFactory *proxy_factory)
: CellularCapability(cellular, proxy_factory),
- task_factory_(this),
+ weak_ptr_factory_(this),
registration_state_(MM_MODEM_GSM_NETWORK_REG_STATUS_UNKNOWN),
access_technology_(MM_MODEM_GSM_ACCESS_TECH_UNKNOWN),
home_provider_(NULL),
@@ -100,35 +102,35 @@
cellular()->dbus_owner()));
MultiStepAsyncCallHandler *call_handler =
new MultiStepAsyncCallHandler(cellular()->dispatcher());
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::EnableModem, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::EnableModem,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::Register, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::Register,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::GetModemStatus, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::GetModemStatus,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::GetIMEI, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::GetIMEI,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::GetIMSI, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::GetIMSI,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::GetSPN, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::GetSPN,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::GetMSISDN, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::GetMSISDN,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::GetProperties, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::GetProperties,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::GetModemInfo, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::GetModemInfo,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityGSM::GetRegistrationState,
+ call_handler->AddTask(Bind(&CellularCapabilityGSM::GetRegistrationState,
+ weak_ptr_factory_.GetWeakPtr(),
call_handler));
call_handler->PostNextTask();
}