shill: Convert ProxyFactory singleton to LazyInstance.
This makes it consistent with the rest of shill's singletons (DHCPProvider,
Resolver, RoutingTable, RTNLHandler) and improves static object's memory
management.
BUG=chromium-os:19178
TEST=unit tests, tested in a VM
Change-Id: Ib403d31473360b46dd25d12508c799cbc73368fd
Reviewed-on: http://gerrit.chromium.org/gerrit/8861
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
diff --git a/modem_manager.cc b/modem_manager.cc
index 090a5b1..91cad69 100644
--- a/modem_manager.cc
+++ b/modem_manager.cc
@@ -23,7 +23,8 @@
EventDispatcher *dispatcher,
Manager *manager,
GLib *glib)
- : service_(service),
+ : proxy_factory_(ProxyFactory::GetInstance()),
+ service_(service),
path_(path),
watcher_id_(0),
control_interface_(control_interface),
@@ -59,8 +60,7 @@
void ModemManager::Connect(const string &owner) {
owner_ = owner;
- proxy_.reset(
- ProxyFactory::factory()->CreateModemManagerProxy(this, path_, owner_));
+ proxy_.reset(proxy_factory_->CreateModemManagerProxy(this, path_, owner_));
// TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
vector<DBus::Path> devices = proxy_->EnumerateDevices();