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

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

Issue 545533002: Move ServiceWorkerCache backend creation to a lazy init function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_pointers_keys
Patch Set: Rebase 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_cache.h
diff --git a/content/browser/service_worker/service_worker_cache.h b/content/browser/service_worker/service_worker_cache.h
index 295ee29d1e73bfbb528ae3fbb38fb1ed8c0846fa..3c402cd0495e48b520b192712d918702753b58fa 100644
--- a/content/browser/service_worker/service_worker_cache.h
+++ b/content/browser/service_worker/service_worker_cache.h
@@ -59,13 +59,10 @@ class CONTENT_EXPORT ServiceWorkerCache {
net::URLRequestContext* request_context,
base::WeakPtr<storage::BlobStorageContext> blob_context);
+ // Operations in progress will complete after the cache is deleted but pending
+ // operations (those operations waiting for init to finish) won't.
virtual ~ServiceWorkerCache();
- // Loads the backend and calls the callback with the result (true for
- // success). This must be called before member functions that require a
- // backend are called. The callback will always be called.
- void CreateBackend(const ErrorCallback& callback);
-
// Returns ErrorTypeNotFound if not found. The callback will always be called.
// |request| must remain valid until the callback is called.
void Match(scoped_ptr<ServiceWorkerFetchRequest> request,
@@ -90,9 +87,6 @@ class CONTENT_EXPORT ServiceWorkerCache {
// callback will always be called.
void Keys(const RequestsCallback& callback);
- // Call to determine if CreateBackend must be called.
- bool HasCreatedBackend() const;
-
void set_backend(scoped_ptr<disk_cache::Backend> backend) {
backend_ = backend.Pass();
}
@@ -107,6 +101,11 @@ class CONTENT_EXPORT ServiceWorkerCache {
net::URLRequestContext* request_context,
base::WeakPtr<storage::BlobStorageContext> blob_context);
+ void PutImpl(scoped_ptr<ServiceWorkerFetchRequest> request,
+ scoped_ptr<ServiceWorkerResponse> response,
+ scoped_ptr<storage::BlobDataHandle> blob_data_handle,
+ const ErrorCallback& callback);
+
// Static callbacks for the Keys function.
static void KeysDidOpenNextEntry(scoped_ptr<KeysContext> keys_context,
int rv);
@@ -117,10 +116,19 @@ class CONTENT_EXPORT ServiceWorkerCache {
const Entries::iterator& iter,
scoped_ptr<ServiceWorkerRequestResponseHeaders> headers);
+ // Loads the backend and calls the callback with the result (true for
+ // success). The callback will always be called.
+ void CreateBackend(const ErrorCallback& callback);
+
+ void Init(const base::Closure& callback);
+ void InitDone(ErrorType error);
+
scoped_ptr<disk_cache::Backend> backend_;
base::FilePath path_;
net::URLRequestContext* request_context_;
base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
+ bool initialized_;
+ std::vector<base::Closure> init_callbacks_;
base::WeakPtrFactory<ServiceWorkerCache> weak_ptr_factory_;
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698