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

Side by Side Diff: content/browser/cache_storage/cache_storage_cache.h

Issue 1719103002: CacheStorage: Expand cache.keys() method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_
6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // 95 //
96 // TODO(nhiroki): This function should run all operations atomically. 96 // TODO(nhiroki): This function should run all operations atomically.
97 // http://crbug.com/486637 97 // http://crbug.com/486637
98 void BatchOperation(const std::vector<CacheStorageBatchOperation>& operations, 98 void BatchOperation(const std::vector<CacheStorageBatchOperation>& operations,
99 const ErrorCallback& callback); 99 const ErrorCallback& callback);
100 void BatchDidOneOperation(const base::Closure& barrier_closure, 100 void BatchDidOneOperation(const base::Closure& barrier_closure,
101 ErrorCallback* callback, 101 ErrorCallback* callback,
102 CacheStorageError error); 102 CacheStorageError error);
103 void BatchDidAllOperations(scoped_ptr<ErrorCallback> callback); 103 void BatchDidAllOperations(scoped_ptr<ErrorCallback> callback);
104 104
105 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest.
106 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors. 105 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors.
107 void Keys(const RequestsCallback& callback); 106 void Keys(scoped_ptr<ServiceWorkerFetchRequest> request,
107 const CacheStorageCacheQueryParams& match_params,
108 const RequestsCallback& callback);
108 109
109 // Closes the backend. Future operations that require the backend 110 // Closes the backend. Future operations that require the backend
110 // will exit early. Close should only be called once per CacheStorageCache. 111 // will exit early. Close should only be called once per CacheStorageCache.
111 void Close(const base::Closure& callback); 112 void Close(const base::Closure& callback);
112 113
113 // The size of the cache's contents. This runs in parallel with other Cache 114 // The size of the cache's contents. This runs in parallel with other Cache
114 // operations. 115 // operations.
115 void Size(const SizeCallback& callback); 116 void Size(const SizeCallback& callback);
116 117
117 // Gets the cache's size, closes the backend, and then runs |callback| with 118 // Gets the cache's size, closes the backend, and then runs |callback| with
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 const ErrorCallback& callback, 231 const ErrorCallback& callback,
231 scoped_ptr<OpenAllEntriesContext> entries_context, 232 scoped_ptr<OpenAllEntriesContext> entries_context,
232 CacheStorageError error); 233 CacheStorageError error);
233 void DeleteDidOpenEntry(const GURL& origin, 234 void DeleteDidOpenEntry(const GURL& origin,
234 scoped_ptr<ServiceWorkerFetchRequest> request, 235 scoped_ptr<ServiceWorkerFetchRequest> request,
235 const CacheStorageCache::ErrorCallback& callback, 236 const CacheStorageCache::ErrorCallback& callback,
236 scoped_ptr<disk_cache::Entry*> entryptr, 237 scoped_ptr<disk_cache::Entry*> entryptr,
237 int rv); 238 int rv);
238 239
239 // Keys callbacks. 240 // Keys callbacks.
240 void KeysImpl(const RequestsCallback& callback); 241 void KeysImpl(scoped_ptr<ServiceWorkerFetchRequest> request,
241 void KeysDidOpenAllEntries(const RequestsCallback& callback, 242 const CacheStorageCacheQueryParams& match_params,
243 const RequestsCallback& callback);
244 void KeysDidOpenAllEntries(scoped_ptr<KeysContext> keys_context,
242 scoped_ptr<OpenAllEntriesContext> entries_context, 245 scoped_ptr<OpenAllEntriesContext> entries_context,
243 CacheStorageError error); 246 CacheStorageError error);
244 void KeysProcessNextEntry(scoped_ptr<KeysContext> keys_context, 247 void KeysProcessNextEntry(scoped_ptr<KeysContext> keys_context,
245 const Entries::iterator& iter); 248 const Entries::iterator& iter);
246 void KeysDidReadMetadata(scoped_ptr<KeysContext> keys_context, 249 void KeysDidReadMetadata(scoped_ptr<KeysContext> keys_context,
247 const Entries::iterator& iter, 250 const Entries::iterator& iter,
248 scoped_ptr<CacheMetadata> metadata); 251 scoped_ptr<CacheMetadata> metadata);
252 void KeyDidOpenEntry(scoped_ptr<ServiceWorkerFetchRequest> request,
253 const RequestsCallback& callback,
254 scoped_ptr<disk_cache::Entry*> entry_ptr,
255 int rv);
256 void KeyDidReadMetadata(scoped_ptr<ServiceWorkerFetchRequest> request,
257 const RequestsCallback& callback,
258 disk_cache::ScopedEntryPtr entry,
259 scoped_ptr<CacheMetadata> metadata);
249 260
250 void CloseImpl(const base::Closure& callback); 261 void CloseImpl(const base::Closure& callback);
251 262
252 void SizeImpl(const SizeCallback& callback); 263 void SizeImpl(const SizeCallback& callback);
253 264
254 void GetSizeThenCloseDidGetSize(const SizeCallback& callback, 265 void GetSizeThenCloseDidGetSize(const SizeCallback& callback,
255 int64_t cache_size); 266 int64_t cache_size);
256 267
257 // Loads the backend and calls the callback with the result (true for 268 // Loads the backend and calls the callback with the result (true for
258 // success). The callback will always be called. Virtual for tests. 269 // success). The callback will always be called. Virtual for tests.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 bool memory_only_; 319 bool memory_only_;
309 320
310 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; 321 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_;
311 322
312 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); 323 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache);
313 }; 324 };
314 325
315 } // namespace content 326 } // namespace content
316 327
317 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ 328 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698