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

Unified Diff: chromeos/dbus/gsm_sms_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
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);
};
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc ('k') | chromeos/dbus/modem_messaging_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698