| Index: trunk/src/chromeos/dbus/shill_service_client.cc
|
| ===================================================================
|
| --- trunk/src/chromeos/dbus/shill_service_client.cc (revision 227138)
|
| +++ trunk/src/chromeos/dbus/shill_service_client.cc (working copy)
|
| @@ -5,13 +5,11 @@
|
| #include "chromeos/dbus/shill_service_client.h"
|
|
|
| #include "base/bind.h"
|
| -#include "base/memory/weak_ptr.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/stl_util.h"
|
| #include "base/values.h"
|
| #include "chromeos/dbus/shill_property_changed_observer.h"
|
| #include "chromeos/dbus/shill_service_client_stub.h"
|
| -#include "chromeos/network/network_event_log.h"
|
| #include "dbus/bus.h"
|
| #include "dbus/message.h"
|
| #include "dbus/object_proxy.h"
|
| @@ -56,20 +54,9 @@
|
| public:
|
| explicit ShillServiceClientImpl()
|
| : bus_(NULL),
|
| - weak_ptr_factory_(this) {
|
| + helpers_deleter_(&helpers_) {
|
| }
|
|
|
| - virtual ~ShillServiceClientImpl() {
|
| - for (HelperMap::iterator iter = helpers_.begin();
|
| - iter != helpers_.end(); ++iter) {
|
| - ShillClientHelper* helper = iter->second;
|
| - bus_->RemoveObjectProxy(shill::kFlimflamServiceName,
|
| - helper->object_proxy()->object_path(),
|
| - base::Bind(&base::DoNothing));
|
| - delete helper;
|
| - }
|
| - }
|
| -
|
| virtual void AddPropertyChangedObserver(
|
| const dbus::ObjectPath& service_path,
|
| ShillPropertyChangedObserver* observer) OVERRIDE {
|
| @@ -235,33 +222,17 @@
|
| return it->second;
|
|
|
| // There is no helper for the profile, create it.
|
| - NET_LOG_DEBUG("AddShillClientHelper", service_path.value());
|
| dbus::ObjectProxy* object_proxy =
|
| bus_->GetObjectProxy(shill::kFlimflamServiceName, service_path);
|
| - ShillClientHelper* helper = new ShillClientHelper(object_proxy);
|
| - helper->SetReleasedCallback(
|
| - base::Bind(&ShillServiceClientImpl::NotifyReleased,
|
| - weak_ptr_factory_.GetWeakPtr()));
|
| + ShillClientHelper* helper = new ShillClientHelper(bus_, object_proxy);
|
| helper->MonitorPropertyChanged(shill::kFlimflamServiceInterface);
|
| helpers_.insert(HelperMap::value_type(service_path.value(), helper));
|
| return helper;
|
| }
|
|
|
| - void NotifyReleased(ShillClientHelper* helper) {
|
| - // New Shill Service DBus objects are created relatively frequently, so
|
| - // remove them when they become inactive (no observers and no active method
|
| - // calls).
|
| - const dbus::ObjectPath& object_path = helper->object_proxy()->object_path();
|
| - NET_LOG_DEBUG("RemoveShillClientHelper", object_path.value());
|
| - bus_->RemoveObjectProxy(shill::kFlimflamServiceName,
|
| - object_path, base::Bind(&base::DoNothing));
|
| - helpers_.erase(object_path.value());
|
| - delete helper;
|
| - }
|
| -
|
| dbus::Bus* bus_;
|
| HelperMap helpers_;
|
| - base::WeakPtrFactory<ShillServiceClientImpl> weak_ptr_factory_;
|
| + STLValueDeleter<HelperMap> helpers_deleter_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ShillServiceClientImpl);
|
| };
|
|
|