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

Unified Diff: chromeos/dbus/shill_profile_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/shill_ipconfig_client.cc ('k') | components/autofill/core/common/password_form.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/shill_profile_client.cc
diff --git a/chromeos/dbus/shill_profile_client.cc b/chromeos/dbus/shill_profile_client.cc
index 291c36a07cb807e27ce293a0410f433794033a0c..638b92f64a4769e4c214305224e814d824951963 100644
--- a/chromeos/dbus/shill_profile_client.cc
+++ b/chromeos/dbus/shill_profile_client.cc
@@ -5,8 +5,9 @@
#include "chromeos/dbus/shill_profile_client.h"
#include "base/bind.h"
+#include "base/containers/scoped_ptr_map.h"
+#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
-#include "base/stl_util.h"
#include "base/values.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/shill_property_changed_observer.h"
@@ -56,36 +57,35 @@ class ShillProfileClientImpl : public ShillProfileClient {
void Init(dbus::Bus* bus) override { bus_ = bus; }
private:
- typedef std::map<std::string, ShillClientHelper*> HelperMap;
+ typedef base::ScopedPtrMap<std::string, scoped_ptr<ShillClientHelper>>
+ HelperMap;
// Returns the corresponding ShillClientHelper for the profile.
ShillClientHelper* GetHelper(const dbus::ObjectPath& profile_path);
dbus::Bus* bus_;
HelperMap helpers_;
- STLValueDeleter<HelperMap> helpers_deleter_;
DISALLOW_COPY_AND_ASSIGN(ShillProfileClientImpl);
};
-ShillProfileClientImpl::ShillProfileClientImpl()
- : bus_(NULL),
- helpers_deleter_(&helpers_) {
+ShillProfileClientImpl::ShillProfileClientImpl() : bus_(NULL) {
}
ShillClientHelper* ShillProfileClientImpl::GetHelper(
const dbus::ObjectPath& profile_path) {
- HelperMap::iterator it = helpers_.find(profile_path.value());
+ HelperMap::const_iterator it = helpers_.find(profile_path.value());
if (it != helpers_.end())
return it->second;
// There is no helper for the profile, create it.
dbus::ObjectProxy* object_proxy =
bus_->GetObjectProxy(shill::kFlimflamServiceName, profile_path);
- ShillClientHelper* helper = new ShillClientHelper(object_proxy);
+ scoped_ptr<ShillClientHelper> helper(new ShillClientHelper(object_proxy));
helper->MonitorPropertyChanged(shill::kFlimflamProfileInterface);
- helpers_.insert(HelperMap::value_type(profile_path.value(), helper));
- return helper;
+ ShillClientHelper* helper_ptr = helper.get();
+ helpers_.insert(profile_path.value(), helper.Pass());
+ return helper_ptr;
}
void ShillProfileClientImpl::GetProperties(
« no previous file with comments | « chromeos/dbus/shill_ipconfig_client.cc ('k') | components/autofill/core/common/password_form.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698