Index: chromeos/dbus/modem_messaging_client.cc |
diff --git a/chromeos/dbus/modem_messaging_client.cc b/chromeos/dbus/modem_messaging_client.cc |
index ce4929dc9b91c8183783788b1764fdc255518918..731adf90f478627169e4ea62ae00fa6ee050ed04 100644 |
--- a/chromeos/dbus/modem_messaging_client.cc |
+++ b/chromeos/dbus/modem_messaging_client.cc |
@@ -3,13 +3,13 @@ |
// found in the LICENSE file. |
#include "chromeos/dbus/modem_messaging_client.h" |
-#include <map> |
#include <utility> |
#include "base/bind.h" |
+#include "base/containers/scoped_ptr_map.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
#include "base/message_loop/message_loop.h" |
-#include "base/stl_util.h" |
#include "base/values.h" |
#include "dbus/bus.h" |
#include "dbus/message.h" |
@@ -133,10 +133,7 @@ class ModemMessagingProxy { |
class CHROMEOS_EXPORT ModemMessagingClientImpl : public ModemMessagingClient { |
public: |
- ModemMessagingClientImpl() |
- : bus_(NULL), |
- proxies_deleter_(&proxies_) { |
- } |
+ ModemMessagingClientImpl() : bus_(NULL) {} |
void SetSmsReceivedHandler(const std::string& service_name, |
const dbus::ObjectPath& object_path, |
@@ -166,27 +163,27 @@ class CHROMEOS_EXPORT ModemMessagingClientImpl : public ModemMessagingClient { |
void Init(dbus::Bus* bus) override { bus_ = bus; }; |
private: |
- typedef std::map<std::pair<std::string, std::string>, ModemMessagingProxy*> |
- ProxyMap; |
+ typedef base::ScopedPtrMap<std::pair<std::string, std::string>, |
+ scoped_ptr<ModemMessagingProxy>> ProxyMap; |
// Returns a SMSProxy for the given service name and object path. |
ModemMessagingProxy* GetProxy(const std::string& service_name, |
const dbus::ObjectPath& object_path) { |
const ProxyMap::key_type key(service_name, object_path.value()); |
- ProxyMap::iterator it = proxies_.find(key); |
+ ProxyMap::const_iterator it = proxies_.find(key); |
if (it != proxies_.end()) |
return it->second; |
// There is no proxy for the service_name and object_path, create it. |
- ModemMessagingProxy* proxy |
- = new ModemMessagingProxy(bus_, service_name, object_path); |
- proxies_.insert(ProxyMap::value_type(key, proxy)); |
- return proxy; |
+ scoped_ptr<ModemMessagingProxy> proxy( |
+ new ModemMessagingProxy(bus_, service_name, object_path)); |
+ ModemMessagingProxy* proxy_ptr = proxy.get(); |
+ proxies_.insert(key, proxy.Pass()); |
+ return proxy_ptr; |
} |
dbus::Bus* bus_; |
ProxyMap proxies_; |
- STLValueDeleter<ProxyMap> proxies_deleter_; |
DISALLOW_COPY_AND_ASSIGN(ModemMessagingClientImpl); |
}; |