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

Unified Diff: content/browser/cache_storage/cache_storage_cache.h

Issue 1248003004: CacheStorage: Implement Cache.matchAll() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/cache_storage/cache_storage_cache.h
diff --git a/content/browser/cache_storage/cache_storage_cache.h b/content/browser/cache_storage/cache_storage_cache.h
index 3284b658000fe4b8e9ffc24e6141aacab98b4b71..fe407a57ba9e56133e73688ed198f9911e9fb375 100644
--- a/content/browser/cache_storage/cache_storage_cache.h
+++ b/content/browser/cache_storage/cache_storage_cache.h
@@ -46,6 +46,10 @@ class CONTENT_EXPORT CacheStorageCache
base::Callback<void(CacheStorageError,
scoped_ptr<ServiceWorkerResponse>,
scoped_ptr<storage::BlobDataHandle>)>;
+ using ResponsesCallback =
+ base::Callback<void(CacheStorageError,
+ const std::vector<ServiceWorkerResponse>&,
+ ScopedVector<storage::BlobDataHandle>)>;
using Requests = std::vector<ServiceWorkerFetchRequest>;
using RequestsCallback =
base::Callback<void(CacheStorageError, scoped_ptr<Requests>)>;
@@ -66,6 +70,10 @@ class CONTENT_EXPORT CacheStorageCache
void Match(scoped_ptr<ServiceWorkerFetchRequest> request,
const ResponseCallback& callback);
+ // Returns CACHE_STORAGE_OK and all responses in this cache. If there is no
+ // response, returns CACHE_STORAGE_OK and an empty vector.
+ void MatchAll(const ResponsesCallback& callback);
+
// Runs given batch operations. This corresponds to the Batch Cache Operations
// algorithm in the spec.
//
@@ -104,6 +112,7 @@ class CONTENT_EXPORT CacheStorageCache
friend class base::RefCounted<CacheStorageCache>;
friend class TestCacheStorageCache;
+ struct MatchAllContext;
struct KeysContext;
struct PutContext;
@@ -145,6 +154,14 @@ class CONTENT_EXPORT CacheStorageCache
disk_cache::ScopedEntryPtr entry,
scoped_ptr<CacheMetadata> headers);
+ // MatchAll callbacks
+ void MatchAllImpl(const ResponsesCallback& callback);
+ void MatchAllDidOpenNextEntry(scoped_ptr<MatchAllContext> context, int rv);
+ void MatchAllProcessNextEntry(scoped_ptr<MatchAllContext> context);
+ void MatchAllDidReadMetadata(scoped_ptr<MatchAllContext> context,
+ disk_cache::ScopedEntryPtr entry,
+ scoped_ptr<CacheMetadata> metadata);
+
// Puts the request and response object in the cache. The response body (if
// present) is stored in the cache, but not the request body. Returns OK on
// success.
@@ -206,6 +223,11 @@ class CONTENT_EXPORT CacheStorageCache
CacheStorageError error,
scoped_ptr<ServiceWorkerResponse> response,
scoped_ptr<storage::BlobDataHandle> blob_data_handle);
+ void PendingResponsesCallback(
+ const ResponsesCallback& callback,
+ CacheStorageError error,
+ const std::vector<ServiceWorkerResponse>& responses,
+ ScopedVector<storage::BlobDataHandle> blob_data_handles);
void PendingRequestsCallback(const RequestsCallback& callback,
CacheStorageError error,
scoped_ptr<Requests> requests);

Powered by Google App Engine
This is Rietveld 408576698