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 { |