OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/browser/api/storage/local_value_store_cache.h" | 5 #include "extensions/browser/api/storage/local_value_store_cache.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 ValueStore* LocalValueStoreCache::GetStorage(const Extension* extension) { | 74 ValueStore* LocalValueStoreCache::GetStorage(const Extension* extension) { |
75 StorageMap::iterator iter = storage_map_.find(extension->id()); | 75 StorageMap::iterator iter = storage_map_.find(extension->id()); |
76 if (iter != storage_map_.end()) | 76 if (iter != storage_map_.end()) |
77 return iter->second.get(); | 77 return iter->second.get(); |
78 | 78 |
79 ValueStoreFactory::ModelType model_type = | 79 ValueStoreFactory::ModelType model_type = |
80 extension->is_app() ? ValueStoreFactory::ModelType::APP | 80 extension->is_app() ? ValueStoreFactory::ModelType::APP |
81 : ValueStoreFactory::ModelType::EXTENSION; | 81 : ValueStoreFactory::ModelType::EXTENSION; |
82 std::unique_ptr<ValueStore> store = storage_factory_->CreateSettingsStore( | 82 std::unique_ptr<ValueStore> store = storage_factory_->CreateSettingsStore( |
83 settings_namespace::LOCAL, model_type, extension->id()); | 83 settings_namespace::LOCAL, model_type, extension->id()); |
84 linked_ptr<SettingsStorageQuotaEnforcer> storage( | 84 std::unique_ptr<SettingsStorageQuotaEnforcer> storage( |
85 new SettingsStorageQuotaEnforcer(quota_, std::move(store))); | 85 new SettingsStorageQuotaEnforcer(quota_, std::move(store))); |
86 DCHECK(storage.get()); | 86 DCHECK(storage.get()); |
87 | 87 |
88 storage_map_[extension->id()] = storage; | 88 ValueStore* storage_ptr = storage.get(); |
89 return storage.get(); | 89 storage_map_[extension->id()] = std::move(storage); |
| 90 return storage_ptr; |
90 } | 91 } |
91 | 92 |
92 } // namespace extensions | 93 } // namespace extensions |
OLD | NEW |