| 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..adac254a232a7c1c3f668836ebcd9180f84db9d3 100644
|
| --- a/content/browser/cache_storage/cache_storage_cache.h
|
| +++ b/content/browser/cache_storage/cache_storage_cache.h
|
| @@ -46,6 +46,11 @@ class CONTENT_EXPORT CacheStorageCache
|
| base::Callback<void(CacheStorageError,
|
| scoped_ptr<ServiceWorkerResponse>,
|
| scoped_ptr<storage::BlobDataHandle>)>;
|
| + using Responses = std::vector<ServiceWorkerResponse>;
|
| + using BlobDataHandles = std::vector<storage::BlobDataHandle>;
|
| + using ResponsesCallback = base::Callback<void(CacheStorageError,
|
| + scoped_ptr<Responses>,
|
| + scoped_ptr<BlobDataHandles>)>;
|
| 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 are no
|
| + // responses, 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,10 +240,20 @@ class CONTENT_EXPORT CacheStorageCache
|
| CacheStorageError error,
|
| scoped_ptr<ServiceWorkerResponse> response,
|
| scoped_ptr<storage::BlobDataHandle> blob_data_handle);
|
| + void PendingResponsesCallback(const ResponsesCallback& callback,
|
| + CacheStorageError error,
|
| + scoped_ptr<Responses> responses,
|
| + scoped_ptr<BlobDataHandles> blob_data_handles);
|
| void PendingRequestsCallback(const RequestsCallback& callback,
|
| CacheStorageError error,
|
| scoped_ptr<Requests> requests);
|
|
|
| + void PopulateResponseMetadata(const CacheMetadata& metadata,
|
| + ServiceWorkerResponse* response);
|
| + scoped_ptr<storage::BlobDataHandle> PopulateResponseBody(
|
| + disk_cache::ScopedEntryPtr entry,
|
| + ServiceWorkerResponse* response);
|
| +
|
| // Be sure to check |backend_state_| before use.
|
| scoped_ptr<disk_cache::Backend> backend_;
|
|
|
|
|