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..fe3dd6a7d196109e0815268280f35d7fe1c14aed 100644 |
--- a/content/browser/cache_storage/cache_storage_cache.h |
+++ b/content/browser/cache_storage/cache_storage_cache.h |
@@ -11,6 +11,7 @@ |
#include "base/files/file_path.h" |
#include "base/id_map.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_vector.h" |
#include "base/memory/weak_ptr.h" |
#include "content/common/cache_storage/cache_storage_types.h" |
#include "content/common/service_worker/service_worker_types.h" |
@@ -46,6 +47,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>&, |
jkarlin
2015/08/05 12:09:05
Let's make this a scoped_ptr<std::vector<ServiceWo
nhiroki
2015/08/06 03:36:53
Done.
|
+ ScopedVector<storage::BlobDataHandle>)>; |
using Requests = std::vector<ServiceWorkerFetchRequest>; |
using RequestsCallback = |
base::Callback<void(CacheStorageError, scoped_ptr<Requests>)>; |
@@ -66,6 +71,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 |
jkarlin
2015/08/05 12:09:05
s/there is no response/there are no responses/
nhiroki
2015/08/06 03:36:53
Done.
|
+ // 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 +113,8 @@ class CONTENT_EXPORT CacheStorageCache |
friend class base::RefCounted<CacheStorageCache>; |
friend class TestCacheStorageCache; |
+ struct OpenAllEntriesContext; |
+ struct MatchAllContext; |
struct KeysContext; |
struct PutContext; |
@@ -119,6 +130,9 @@ class CONTENT_EXPORT CacheStorageCache |
using ScopedBackendPtr = scoped_ptr<disk_cache::Backend>; |
using BlobToDiskCacheIDMap = |
IDMap<CacheStorageBlobToDiskCache, IDMapOwnPointer>; |
+ using OpenAllEntriesCallback = |
+ base::Callback<void(scoped_ptr<OpenAllEntriesContext>, |
+ CacheStorageError)>; |
CacheStorageCache( |
const GURL& origin, |
@@ -133,6 +147,12 @@ class CONTENT_EXPORT CacheStorageCache |
// Returns true if the backend is ready to operate. |
bool LazyInitialize(); |
+ // Returns all entries in this cache. |
+ void OpenAllEntries(const OpenAllEntriesCallback& callback); |
+ void DidOpenNextEntry(scoped_ptr<OpenAllEntriesContext> entries_context, |
+ const OpenAllEntriesCallback& callback, |
+ int rv); |
+ |
// Match callbacks |
void MatchImpl(scoped_ptr<ServiceWorkerFetchRequest> request, |
const ResponseCallback& callback); |
@@ -145,6 +165,18 @@ class CONTENT_EXPORT CacheStorageCache |
disk_cache::ScopedEntryPtr entry, |
scoped_ptr<CacheMetadata> headers); |
+ // MatchAll callbacks |
+ void MatchAllImpl(const ResponsesCallback& callback); |
+ void MatchAllDidOpenAllEntries( |
+ const ResponsesCallback& callback, |
+ scoped_ptr<OpenAllEntriesContext> entries_context, |
+ CacheStorageError error); |
+ void MatchAllProcessNextEntry(scoped_ptr<MatchAllContext> context, |
+ const Entries::iterator& iter); |
+ void MatchAllDidReadMetadata(scoped_ptr<MatchAllContext> context, |
+ const Entries::iterator& iter, |
+ 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. |
@@ -179,7 +211,9 @@ class CONTENT_EXPORT CacheStorageCache |
// Keys callbacks. |
void KeysImpl(const RequestsCallback& callback); |
- void KeysDidOpenNextEntry(scoped_ptr<KeysContext> keys_context, int rv); |
+ void KeysDidOpenAllEntries(const RequestsCallback& callback, |
+ scoped_ptr<OpenAllEntriesContext> entries_context, |
+ CacheStorageError error); |
void KeysProcessNextEntry(scoped_ptr<KeysContext> keys_context, |
const Entries::iterator& iter); |
void KeysDidReadMetadata(scoped_ptr<KeysContext> keys_context, |
@@ -206,6 +240,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); |