Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: chromeos/dbus/modem_messaging_client.cc

Issue 1096983002: Update usages of std::map to use ScopedPtrMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@passwordmanager-scopedmemory
Patch Set: Rebase. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/gsm_sms_client.cc ('k') | chromeos/dbus/shill_ipconfig_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « chromeos/dbus/gsm_sms_client.cc ('k') | chromeos/dbus/shill_ipconfig_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698