| OLD | NEW |
| 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_H_ | 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ |
| 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ | 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // TODO(jkarlin): Rename to DoomCache. | 84 // TODO(jkarlin): Rename to DoomCache. |
| 85 void DeleteCache(const std::string& cache_name, | 85 void DeleteCache(const std::string& cache_name, |
| 86 const BoolAndErrorCallback& callback); | 86 const BoolAndErrorCallback& callback); |
| 87 | 87 |
| 88 // Calls the callback with a vector of cache names (keys) available. | 88 // Calls the callback with a vector of cache names (keys) available. |
| 89 void EnumerateCaches(const StringsAndErrorCallback& callback); | 89 void EnumerateCaches(const StringsAndErrorCallback& callback); |
| 90 | 90 |
| 91 // Calls match on the cache with the given |cache_name|. | 91 // Calls match on the cache with the given |cache_name|. |
| 92 void MatchCache(const std::string& cache_name, | 92 void MatchCache(const std::string& cache_name, |
| 93 std::unique_ptr<ServiceWorkerFetchRequest> request, | 93 std::unique_ptr<ServiceWorkerFetchRequest> request, |
| 94 const CacheStorageCacheQueryParams& match_params, |
| 94 const CacheStorageCache::ResponseCallback& callback); | 95 const CacheStorageCache::ResponseCallback& callback); |
| 95 | 96 |
| 96 // Calls match on all of the caches in parallel, calling |callback| with the | 97 // Calls match on all of the caches in parallel, calling |callback| with the |
| 97 // response from the first cache (in order of cache creation) to have the | 98 // response from the first cache (in order of cache creation) to have the |
| 98 // entry. If no response is found then |callback| is called with | 99 // entry. If no response is found then |callback| is called with |
| 99 // CACHE_STORAGE_ERROR_NOT_FOUND. | 100 // CACHE_STORAGE_ERROR_NOT_FOUND. |
| 100 void MatchAllCaches(std::unique_ptr<ServiceWorkerFetchRequest> request, | 101 void MatchAllCaches(std::unique_ptr<ServiceWorkerFetchRequest> request, |
| 102 const CacheStorageCacheQueryParams& match_params, |
| 101 const CacheStorageCache::ResponseCallback& callback); | 103 const CacheStorageCache::ResponseCallback& callback); |
| 102 | 104 |
| 103 // Sums the sizes of each cache and closes them. Runs |callback| with the | 105 // Sums the sizes of each cache and closes them. Runs |callback| with the |
| 104 // size. | 106 // size. |
| 105 void GetSizeThenCloseAllCaches(const SizeCallback& callback); | 107 void GetSizeThenCloseAllCaches(const SizeCallback& callback); |
| 106 | 108 |
| 107 // The size of all of the origin's contents. This value should be used as an | 109 // The size of all of the origin's contents. This value should be used as an |
| 108 // estimate only since the cache may be modified at any time. | 110 // estimate only since the cache may be modified at any time. |
| 109 void Size(const SizeCallback& callback); | 111 void Size(const SizeCallback& callback); |
| 110 | 112 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void DeleteCacheDidGetSize(std::unique_ptr<CacheStorageCache> cache, | 169 void DeleteCacheDidGetSize(std::unique_ptr<CacheStorageCache> cache, |
| 168 int64_t cache_size); | 170 int64_t cache_size); |
| 169 void DeleteCacheDidCleanUp(bool success); | 171 void DeleteCacheDidCleanUp(bool success); |
| 170 | 172 |
| 171 // The EnumerateCache callbacks are below. | 173 // The EnumerateCache callbacks are below. |
| 172 void EnumerateCachesImpl(const StringsAndErrorCallback& callback); | 174 void EnumerateCachesImpl(const StringsAndErrorCallback& callback); |
| 173 | 175 |
| 174 // The MatchCache callbacks are below. | 176 // The MatchCache callbacks are below. |
| 175 void MatchCacheImpl(const std::string& cache_name, | 177 void MatchCacheImpl(const std::string& cache_name, |
| 176 std::unique_ptr<ServiceWorkerFetchRequest> request, | 178 std::unique_ptr<ServiceWorkerFetchRequest> request, |
| 179 const CacheStorageCacheQueryParams& match_params, |
| 177 const CacheStorageCache::ResponseCallback& callback); | 180 const CacheStorageCache::ResponseCallback& callback); |
| 178 void MatchCacheDidMatch(std::unique_ptr<CacheStorageCacheHandle> cache_handle, | 181 void MatchCacheDidMatch(std::unique_ptr<CacheStorageCacheHandle> cache_handle, |
| 179 const CacheStorageCache::ResponseCallback& callback, | 182 const CacheStorageCache::ResponseCallback& callback, |
| 180 CacheStorageError error, | 183 CacheStorageError error, |
| 181 std::unique_ptr<ServiceWorkerResponse> response, | 184 std::unique_ptr<ServiceWorkerResponse> response, |
| 182 std::unique_ptr<storage::BlobDataHandle> handle); | 185 std::unique_ptr<storage::BlobDataHandle> handle); |
| 183 | 186 |
| 184 // The MatchAllCaches callbacks are below. | 187 // The MatchAllCaches callbacks are below. |
| 185 void MatchAllCachesImpl(std::unique_ptr<ServiceWorkerFetchRequest> request, | 188 void MatchAllCachesImpl(std::unique_ptr<ServiceWorkerFetchRequest> request, |
| 189 const CacheStorageCacheQueryParams& match_params, |
| 186 const CacheStorageCache::ResponseCallback& callback); | 190 const CacheStorageCache::ResponseCallback& callback); |
| 187 void MatchAllCachesDidMatch( | 191 void MatchAllCachesDidMatch( |
| 188 std::unique_ptr<CacheStorageCacheHandle> cache_handle, | 192 std::unique_ptr<CacheStorageCacheHandle> cache_handle, |
| 189 CacheMatchResponse* out_match_response, | 193 CacheMatchResponse* out_match_response, |
| 190 const base::Closure& barrier_closure, | 194 const base::Closure& barrier_closure, |
| 191 CacheStorageError error, | 195 CacheStorageError error, |
| 192 std::unique_ptr<ServiceWorkerResponse> service_worker_response, | 196 std::unique_ptr<ServiceWorkerResponse> service_worker_response, |
| 193 std::unique_ptr<storage::BlobDataHandle> handle); | 197 std::unique_ptr<storage::BlobDataHandle> handle); |
| 194 void MatchAllCachesDidMatchAll( | 198 void MatchAllCachesDidMatchAll( |
| 195 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses, | 199 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 GURL origin_; | 243 GURL origin_; |
| 240 | 244 |
| 241 base::WeakPtrFactory<CacheStorage> weak_factory_; | 245 base::WeakPtrFactory<CacheStorage> weak_factory_; |
| 242 | 246 |
| 243 DISALLOW_COPY_AND_ASSIGN(CacheStorage); | 247 DISALLOW_COPY_AND_ASSIGN(CacheStorage); |
| 244 }; | 248 }; |
| 245 | 249 |
| 246 } // namespace content | 250 } // namespace content |
| 247 | 251 |
| 248 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ | 252 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ |
| OLD | NEW |