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, | |
103 | |
nhiroki
2016/08/18 00:05:42
nit: blank line
jkarlin
2016/08/18 14:08:23
Thanks, I would have thought git cl format would h
| |
101 const CacheStorageCache::ResponseCallback& callback); | 104 const CacheStorageCache::ResponseCallback& callback); |
102 | 105 |
103 // Sums the sizes of each cache and closes them. Runs |callback| with the | 106 // Sums the sizes of each cache and closes them. Runs |callback| with the |
104 // size. | 107 // size. |
105 void GetSizeThenCloseAllCaches(const SizeCallback& callback); | 108 void GetSizeThenCloseAllCaches(const SizeCallback& callback); |
106 | 109 |
107 // The size of all of the origin's contents. This value should be used as an | 110 // 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. | 111 // estimate only since the cache may be modified at any time. |
109 void Size(const SizeCallback& callback); | 112 void Size(const SizeCallback& callback); |
110 | 113 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 void DeleteCacheDidGetSize(std::unique_ptr<CacheStorageCache> cache, | 170 void DeleteCacheDidGetSize(std::unique_ptr<CacheStorageCache> cache, |
168 int64_t cache_size); | 171 int64_t cache_size); |
169 void DeleteCacheDidCleanUp(bool success); | 172 void DeleteCacheDidCleanUp(bool success); |
170 | 173 |
171 // The EnumerateCache callbacks are below. | 174 // The EnumerateCache callbacks are below. |
172 void EnumerateCachesImpl(const StringsAndErrorCallback& callback); | 175 void EnumerateCachesImpl(const StringsAndErrorCallback& callback); |
173 | 176 |
174 // The MatchCache callbacks are below. | 177 // The MatchCache callbacks are below. |
175 void MatchCacheImpl(const std::string& cache_name, | 178 void MatchCacheImpl(const std::string& cache_name, |
176 std::unique_ptr<ServiceWorkerFetchRequest> request, | 179 std::unique_ptr<ServiceWorkerFetchRequest> request, |
180 const CacheStorageCacheQueryParams& match_params, | |
177 const CacheStorageCache::ResponseCallback& callback); | 181 const CacheStorageCache::ResponseCallback& callback); |
178 void MatchCacheDidMatch(std::unique_ptr<CacheStorageCacheHandle> cache_handle, | 182 void MatchCacheDidMatch(std::unique_ptr<CacheStorageCacheHandle> cache_handle, |
179 const CacheStorageCache::ResponseCallback& callback, | 183 const CacheStorageCache::ResponseCallback& callback, |
180 CacheStorageError error, | 184 CacheStorageError error, |
181 std::unique_ptr<ServiceWorkerResponse> response, | 185 std::unique_ptr<ServiceWorkerResponse> response, |
182 std::unique_ptr<storage::BlobDataHandle> handle); | 186 std::unique_ptr<storage::BlobDataHandle> handle); |
183 | 187 |
184 // The MatchAllCaches callbacks are below. | 188 // The MatchAllCaches callbacks are below. |
185 void MatchAllCachesImpl(std::unique_ptr<ServiceWorkerFetchRequest> request, | 189 void MatchAllCachesImpl(std::unique_ptr<ServiceWorkerFetchRequest> request, |
190 const CacheStorageCacheQueryParams& match_params, | |
191 | |
nhiroki
2016/08/18 00:05:42
nit: blank line
jkarlin
2016/08/18 14:08:23
Done.
| |
186 const CacheStorageCache::ResponseCallback& callback); | 192 const CacheStorageCache::ResponseCallback& callback); |
187 void MatchAllCachesDidMatch( | 193 void MatchAllCachesDidMatch( |
188 std::unique_ptr<CacheStorageCacheHandle> cache_handle, | 194 std::unique_ptr<CacheStorageCacheHandle> cache_handle, |
189 CacheMatchResponse* out_match_response, | 195 CacheMatchResponse* out_match_response, |
190 const base::Closure& barrier_closure, | 196 const base::Closure& barrier_closure, |
191 CacheStorageError error, | 197 CacheStorageError error, |
192 std::unique_ptr<ServiceWorkerResponse> service_worker_response, | 198 std::unique_ptr<ServiceWorkerResponse> service_worker_response, |
193 std::unique_ptr<storage::BlobDataHandle> handle); | 199 std::unique_ptr<storage::BlobDataHandle> handle); |
194 void MatchAllCachesDidMatchAll( | 200 void MatchAllCachesDidMatchAll( |
195 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses, | 201 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 GURL origin_; | 245 GURL origin_; |
240 | 246 |
241 base::WeakPtrFactory<CacheStorage> weak_factory_; | 247 base::WeakPtrFactory<CacheStorage> weak_factory_; |
242 | 248 |
243 DISALLOW_COPY_AND_ASSIGN(CacheStorage); | 249 DISALLOW_COPY_AND_ASSIGN(CacheStorage); |
244 }; | 250 }; |
245 | 251 |
246 } // namespace content | 252 } // namespace content |
247 | 253 |
248 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ | 254 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ |
OLD | NEW |