Index: chromeos/dbus/gsm_sms_client.cc |
diff --git a/chromeos/dbus/gsm_sms_client.cc b/chromeos/dbus/gsm_sms_client.cc |
index b311554897ed19cc14a7de55ffef4c32d0c54c39..c996e9e014a7bdd33ec0fad58e18d8defd17e909 100644 |
--- a/chromeos/dbus/gsm_sms_client.cc |
+++ b/chromeos/dbus/gsm_sms_client.cc |
@@ -3,15 +3,14 @@ |
// found in the LICENSE file. |
#include "chromeos/dbus/gsm_sms_client.h" |
-#include <map> |
#include <utility> |
#include <vector> |
#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/strings/stringprintf.h" |
#include "base/values.h" |
#include "dbus/bus.h" |
@@ -162,7 +161,7 @@ class SMSProxy { |
// The GsmSMSClient implementation. |
class GsmSMSClientImpl : public GsmSMSClient { |
public: |
- GsmSMSClientImpl() : bus_(NULL), proxies_deleter_(&proxies_) {} |
+ GsmSMSClientImpl() : bus_(NULL) {} |
// GsmSMSClient override. |
void SetSmsReceivedHandler(const std::string& service_name, |
@@ -208,25 +207,26 @@ class GsmSMSClientImpl : public GsmSMSClient { |
void Init(dbus::Bus* bus) override { bus_ = bus; } |
private: |
- typedef std::map<std::pair<std::string, std::string>, SMSProxy*> ProxyMap; |
+ typedef base::ScopedPtrMap<std::pair<std::string, std::string>, |
+ scoped_ptr<SMSProxy>> ProxyMap; |
// Returns a SMSProxy for the given service name and object path. |
SMSProxy* 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. |
- SMSProxy* proxy = new SMSProxy(bus_, service_name, object_path); |
- proxies_.insert(ProxyMap::value_type(key, proxy)); |
- return proxy; |
+ scoped_ptr<SMSProxy> proxy(new SMSProxy(bus_, service_name, object_path)); |
+ SMSProxy* 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(GsmSMSClientImpl); |
}; |