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

Unified Diff: chrome/browser/extensions/api/storage/managed_value_store_cache.cc

Issue 2466523002: Remove some linked_ptr c/b/extension (Closed)
Patch Set: Created 4 years, 1 month 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: chrome/browser/extensions/api/storage/managed_value_store_cache.cc
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
index 46e3228024ba118e4818ef786d492e5da18e390e..0849e1e988d02ba9ca6d77bf2290016c22a67287 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -346,19 +346,18 @@ PolicyValueStore* ManagedValueStoreCache::GetStoreFor(
const std::string& extension_id) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- PolicyValueStoreMap::iterator it = store_map_.find(extension_id);
+ auto it = store_map_.find(extension_id);
if (it != store_map_.end())
return it->second.get();
// Create the store now, and serve the cached policy until the PolicyService
// sends updated values.
- PolicyValueStore* store = new PolicyValueStore(
+ store_map_[extension_id] = base::MakeUnique<PolicyValueStore>(
extension_id, observers_,
storage_factory_->CreateSettingsStore(settings_namespace::MANAGED,
kManagedModelType, extension_id));
- store_map_[extension_id] = make_linked_ptr(store);
- return store;
+ return store_map_[extension_id].get();
Devlin 2016/11/02 22:25:33 nit: we can save an extra map lookup here by doing
limasdf 2016/11/03 15:29:23 Done.
}
bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const {

Powered by Google App Engine
This is Rietveld 408576698