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_cdma.cc b/cellular_capability_cdma.cc
index 7802b0f..25b642d 100644
--- a/cellular_capability_cdma.cc
+++ b/cellular_capability_cdma.cc
@@ -4,6 +4,7 @@
#include "shill/cellular_capability_cdma.h"
+#include <base/bind.h>
#include <base/logging.h>
#include <base/stringprintf.h>
#include <chromeos/dbus/service_constants.h>
@@ -13,6 +14,7 @@
#include "shill/cellular_service.h"
#include "shill/proxy_factory.h"
+using base::Bind;
using std::string;
namespace shill {
@@ -25,7 +27,7 @@
CellularCapabilityCDMA::CellularCapabilityCDMA(Cellular *cellular,
ProxyFactory *proxy_factory)
: CellularCapability(cellular, proxy_factory),
- task_factory_(this),
+ weak_ptr_factory_(this),
activation_state_(MM_MODEM_CDMA_ACTIVATION_STATE_NOT_ACTIVATED),
registration_state_evdo_(MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN),
registration_state_1x_(MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN),
@@ -44,16 +46,16 @@
MultiStepAsyncCallHandler *call_handler =
new MultiStepAsyncCallHandler(cellular()->dispatcher());
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityCDMA::EnableModem, call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityCDMA::GetModemStatus, call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityCDMA::GetMEID, call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityCDMA::GetModemInfo, call_handler));
- call_handler->AddTask(task_factory_.NewRunnableMethod(
- &CellularCapabilityCDMA::GetRegistrationState, call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityCDMA::EnableModem,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityCDMA::GetModemStatus,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityCDMA::GetMEID,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityCDMA::GetModemInfo,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
+ call_handler->AddTask(Bind(&CellularCapabilityCDMA::GetRegistrationState,
+ weak_ptr_factory_.GetWeakPtr(), call_handler));
call_handler->PostNextTask();
}