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

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

Issue 477973002: Add Keys() function to ServiceWorkerCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cache_patch
Patch Set: Remove accidental change to entry unittest 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 42393a29e1ea10cfff90b9b8babb2f788bd89d3e..ddc13b4871d8f93e2ea306e7d4a8e3aeaaf868ce 100644
--- a/content/browser/service_worker/service_worker_cache.h
+++ b/content/browser/service_worker/service_worker_cache.h
@@ -25,6 +25,7 @@ class BlobStorageContext;
namespace content {
class ChromeBlobStorageContext;
+class ServiceWorkerRequestResponseHeaders;
// TODO(jkarlin): Unload cache backend from memory once the cache object is no
// longer referenced in javascript.
@@ -46,6 +47,10 @@ class CONTENT_EXPORT ServiceWorkerCache {
scoped_ptr<ServiceWorkerResponse>,
scoped_ptr<storage::BlobDataHandle>)>
ResponseCallback;
+ typedef std::vector<ServiceWorkerFetchRequest> Requests;
+ typedef base::Callback<void(ErrorType, scoped_ptr<Requests>)>
+ RequestsCallback;
+
static scoped_ptr<ServiceWorkerCache> CreateMemoryCache(
net::URLRequestContext* request_context,
base::WeakPtr<storage::BlobStorageContext> blob_context);
@@ -80,6 +85,11 @@ class CONTENT_EXPORT ServiceWorkerCache {
void Delete(ServiceWorkerFetchRequest* request,
const ErrorCallback& callback);
+ // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest.
+ // Returns ErrorTypeOK and a vector of requests if there are no errors. The
+ // callback will always be called.
+ void Keys(const RequestsCallback& callback);
+
// Call to determine if CreateBackend must be called.
bool HasCreatedBackend() const;
@@ -90,10 +100,23 @@ class CONTENT_EXPORT ServiceWorkerCache {
base::WeakPtr<ServiceWorkerCache> AsWeakPtr();
private:
+ struct KeysContext;
+ typedef std::vector<disk_cache::Entry*> Entries;
+
ServiceWorkerCache(const base::FilePath& path,
net::URLRequestContext* request_context,
base::WeakPtr<storage::BlobStorageContext> blob_context);
+ // Static callbacks for the Keys function.
+ static void KeysDidOpenNextEntry(scoped_ptr<KeysContext> keys_context,
+ int rv);
+ static void KeysProcessNextEntry(scoped_ptr<KeysContext> keys_context,
+ const Entries::iterator& iter);
+ static void KeysDidReadHeaders(
+ scoped_ptr<KeysContext> keys_context,
+ const Entries::iterator& iter,
+ scoped_ptr<ServiceWorkerRequestResponseHeaders> headers);
+
scoped_ptr<disk_cache::Backend> backend_;
base::FilePath path_;
net::URLRequestContext* request_context_;
« 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