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

Unified Diff: content/browser/service_worker/service_worker_cache_storage.cc

Issue 664433003: [ServiceWorkerCacheStorage] Add support for new Open method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dispatch the response Created 6 years, 2 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
Index: content/browser/service_worker/service_worker_cache_storage.cc
diff --git a/content/browser/service_worker/service_worker_cache_storage.cc b/content/browser/service_worker/service_worker_cache_storage.cc
index 758a124acee71d97c1c8380975cb709347f8a693..1fd5b76ceca04b7ee1a795c2e60eb1efcabab6cb 100644
--- a/content/browser/service_worker/service_worker_cache_storage.cc
+++ b/content/browser/service_worker/service_worker_cache_storage.cc
@@ -376,6 +376,33 @@ void ServiceWorkerCacheStorage::CreateCache(
callback));
}
+void ServiceWorkerCacheStorage::OpenCache(
+ const std::string& cache_name,
+ const CacheAndErrorCallback& callback) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ if (!initialized_) {
+ LazyInit(base::Bind(&ServiceWorkerCacheStorage::OpenCache,
+ weak_factory_.GetWeakPtr(),
+ cache_name,
+ callback));
+ return;
+ }
+
+ scoped_refptr<ServiceWorkerCache> cache = GetLoadedCache(cache_name);
+ if (cache.get()) {
+ callback.Run(cache, CACHE_STORAGE_ERROR_NO_ERROR);
+ return;
+ }
+
+ cache_loader_->CreateCache(
+ cache_name,
+ base::Bind(&ServiceWorkerCacheStorage::CreateCacheDidCreateCache,
+ weak_factory_.GetWeakPtr(),
+ cache_name,
+ callback));
+}
+
void ServiceWorkerCacheStorage::GetCache(
const std::string& cache_name,
const CacheAndErrorCallback& callback) {

Powered by Google App Engine
This is Rietveld 408576698