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

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

Issue 701403002: [ServiceWorkerCache Cleanup] Make the state of the cache backend explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@close_async
Patch Set: Nits Created 6 years, 1 month 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 6683797e99236b9a75d07760068ecd1269e3c75c..b443407f91d63a41fbe77d7f3c1ed45a30f2ad19 100644
--- a/content/browser/service_worker/service_worker_cache.h
+++ b/content/browser/service_worker/service_worker_cache.h
@@ -108,6 +108,15 @@ class CONTENT_EXPORT ServiceWorkerCache
class BlobReader;
struct KeysContext;
struct PutContext;
+
+ // The backend progresses from uninitialized, to open, to closed, and cannot
+ // reverse direction. The open step may be skipped.
+ enum BackendState {
+ BackendUninitialized, // No backend, create backend on first operation.
falken 2014/11/07 05:03:21 Style nit: chromium enums are SNAKE_CASE
jkarlin 2014/11/07 18:55:57 Thanks! Done in https://codereview.chromium.org/69
+ BackendOpen, // Backend can be used.
+ BackendClosed // Backend cannot be used. All ops should fail.
+ };
+
typedef std::vector<disk_cache::Entry*> Entries;
ServiceWorkerCache(
@@ -148,7 +157,7 @@ class CONTENT_EXPORT ServiceWorkerCache
// success). The callback will always be called. Virtual for tests.
virtual void CreateBackend(const ErrorCallback& callback);
- void Init(const base::Closure& callback);
+ void InitBackend(const base::Closure& callback);
void InitDone(ErrorType error);
void IncPendingOps() { pending_ops_++; }
@@ -171,7 +180,7 @@ class CONTENT_EXPORT ServiceWorkerCache
net::URLRequestContext* request_context_;
scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
- bool initialized_;
+ BackendState backend_state_;
std::vector<base::Closure> init_callbacks_;
// Whether or not to store data in disk or memory.
« 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