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

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

Issue 549493002: Expose ServiceWorkerCache objects to ServiceWorkerCacheStorageManager clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refptr3
Patch Set: Fix rebase issue Created 6 years, 3 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.cc
diff --git a/content/browser/service_worker/service_worker_cache.cc b/content/browser/service_worker/service_worker_cache.cc
index 2911b406d1bc0f4109f668ec0c77685ae94f94c1..2fb5216d8f19a7c1ccd4ea561e894b3648adc446 100644
--- a/content/browser/service_worker/service_worker_cache.cc
+++ b/content/browser/service_worker/service_worker_cache.cc
@@ -605,7 +605,7 @@ struct ServiceWorkerCache::KeysContext {
entries[i]->Close();
if (enumerated_entry)
enumerated_entry->Close();
- if (cache && backend_iterator)
+ if (cache && backend_iterator && cache->backend_)
cache->backend_->EndEnumeration(&backend_iterator);
}
@@ -627,19 +627,19 @@ struct ServiceWorkerCache::KeysContext {
};
// static
-scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreateMemoryCache(
+scoped_refptr<ServiceWorkerCache> ServiceWorkerCache::CreateMemoryCache(
net::URLRequestContext* request_context,
base::WeakPtr<storage::BlobStorageContext> blob_context) {
- return make_scoped_ptr(
+ return make_scoped_refptr(
new ServiceWorkerCache(base::FilePath(), request_context, blob_context));
}
// static
-scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreatePersistentCache(
+scoped_refptr<ServiceWorkerCache> ServiceWorkerCache::CreatePersistentCache(
const base::FilePath& path,
net::URLRequestContext* request_context,
base::WeakPtr<storage::BlobStorageContext> blob_context) {
- return make_scoped_ptr(
+ return make_scoped_refptr(
new ServiceWorkerCache(path, request_context, blob_context));
}
@@ -787,6 +787,10 @@ void ServiceWorkerCache::Keys(const RequestsCallback& callback) {
open_entry_callback.Run(rv);
}
+void ServiceWorkerCache::Close() {
+ backend_.reset();
+}
+
ServiceWorkerCache::ServiceWorkerCache(
const base::FilePath& path,
net::URLRequestContext* request_context,
@@ -849,6 +853,12 @@ void ServiceWorkerCache::KeysDidOpenNextEntry(
return;
}
+ if (!cache->backend_) {
+ keys_context->original_callback.Run(ErrorTypeNotFound,
+ scoped_ptr<Requests>());
+ return;
+ }
+
// Store the entry.
keys_context->entries.push_back(keys_context->enumerated_entry);
keys_context->enumerated_entry = NULL;
« no previous file with comments | « content/browser/service_worker/service_worker_cache.h ('k') | content/browser/service_worker/service_worker_cache_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698