| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/storage/settings_frontend.h" | 5 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 ValueStoreCache* cache = caches_[settings_namespace]; | 169 ValueStoreCache* cache = caches_[settings_namespace]; |
| 170 CHECK(cache); | 170 CHECK(cache); |
| 171 | 171 |
| 172 // The |extension| has already been referenced earlier in the stack, so it | 172 // The |extension| has already been referenced earlier in the stack, so it |
| 173 // can't be gone here. | 173 // can't be gone here. |
| 174 // TODO(kalman): change RunWithStorage() to take a | 174 // TODO(kalman): change RunWithStorage() to take a |
| 175 // scoped_refptr<const Extension> instead. | 175 // scoped_refptr<const Extension> instead. |
| 176 scoped_refptr<const Extension> extension = | 176 scoped_refptr<const Extension> extension = |
| 177 extensions::ExtensionSystem::Get(profile_)->extension_service()-> | 177 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
| 178 GetExtensionById(extension_id, true); | 178 GetExtensionById(extension_id, true); |
| 179 CHECK(extension); | 179 CHECK(extension.get()); |
| 180 | 180 |
| 181 BrowserThread::PostTask( | 181 BrowserThread::PostTask( |
| 182 BrowserThread::FILE, FROM_HERE, | 182 BrowserThread::FILE, FROM_HERE, |
| 183 base::Bind(&ValueStoreCache::RunWithValueStoreForExtension, | 183 base::Bind(&ValueStoreCache::RunWithValueStoreForExtension, |
| 184 base::Unretained(cache), callback, extension)); | 184 base::Unretained(cache), callback, extension)); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void SettingsFrontend::DeleteStorageSoon( | 187 void SettingsFrontend::DeleteStorageSoon( |
| 188 const std::string& extension_id) { | 188 const std::string& extension_id) { |
| 189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 207 CacheMap::iterator it = caches_.find(settings_namespace); | 207 CacheMap::iterator it = caches_.find(settings_namespace); |
| 208 if (it != caches_.end()) { | 208 if (it != caches_.end()) { |
| 209 ValueStoreCache* cache = it->second; | 209 ValueStoreCache* cache = it->second; |
| 210 cache->ShutdownOnUI(); | 210 cache->ShutdownOnUI(); |
| 211 BrowserThread::DeleteSoon(BrowserThread::FILE, FROM_HERE, cache); | 211 BrowserThread::DeleteSoon(BrowserThread::FILE, FROM_HERE, cache); |
| 212 caches_.erase(it); | 212 caches_.erase(it); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace extensions | 216 } // namespace extensions |
| OLD | NEW |