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/cellular.cc b/cellular.cc
index b3142d5..81a3212 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -111,6 +111,7 @@
              link_name,
              address,
              interface_index),
+      proxy_factory_(ProxyFactory::GetInstance()),
       type_(type),
       state_(kStateDisabled),
       modem_state_(kModemStateUnknown),
@@ -329,24 +330,21 @@
 
 void Cellular::InitProxies() {
   VLOG(2) << __func__;
-  proxy_.reset(
-      ProxyFactory::factory()->CreateModemProxy(this, dbus_path_, dbus_owner_));
+  proxy_.reset(proxy_factory_->CreateModemProxy(this, dbus_path_, dbus_owner_));
   simple_proxy_.reset(
-      ProxyFactory::factory()->CreateModemSimpleProxy(
-          dbus_path_, dbus_owner_));
+      proxy_factory_->CreateModemSimpleProxy(dbus_path_, dbus_owner_));
   switch (type_) {
     case kTypeGSM:
       gsm_card_proxy_.reset(
-          ProxyFactory::factory()->CreateModemGSMCardProxy(
+          proxy_factory_->CreateModemGSMCardProxy(
               this, dbus_path_, dbus_owner_));
       gsm_network_proxy_.reset(
-          ProxyFactory::factory()->CreateModemGSMNetworkProxy(
+          proxy_factory_->CreateModemGSMNetworkProxy(
               this, dbus_path_, dbus_owner_));
       break;
     case kTypeCDMA:
       cdma_proxy_.reset(
-          ProxyFactory::factory()->CreateModemCDMAProxy(
-              this, dbus_path_, dbus_owner_));
+          proxy_factory_->CreateModemCDMAProxy(this, dbus_path_, dbus_owner_));
       break;
     default: NOTREACHED();
   }