| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 void LazyInitDidLoadIndex( | 131 void LazyInitDidLoadIndex( |
| 132 std::unique_ptr<std::vector<std::string>> indexed_cache_names); | 132 std::unique_ptr<std::vector<std::string>> indexed_cache_names); |
| 133 | 133 |
| 134 // The Open and CreateCache callbacks are below. | 134 // The Open and CreateCache callbacks are below. |
| 135 void OpenCacheImpl(const std::string& cache_name, | 135 void OpenCacheImpl(const std::string& cache_name, |
| 136 const CacheAndErrorCallback& callback); | 136 const CacheAndErrorCallback& callback); |
| 137 void CreateCacheDidCreateCache(const std::string& cache_name, | 137 void CreateCacheDidCreateCache(const std::string& cache_name, |
| 138 const CacheAndErrorCallback& callback, | 138 const CacheAndErrorCallback& callback, |
| 139 scoped_refptr<CacheStorageCache> cache); | 139 scoped_refptr<CacheStorageCache> cache); |
| 140 void CreateCacheDidWriteIndex(const CacheAndErrorCallback& callback, | 140 void CreateCacheDidWriteIndex(const CacheAndErrorCallback& callback, |
| 141 scoped_refptr<CacheStorageCache> cache, |
| 141 bool success); | 142 bool success); |
| 142 | 143 |
| 143 // The HasCache callbacks are below. | 144 // The HasCache callbacks are below. |
| 144 void HasCacheImpl(const std::string& cache_name, | 145 void HasCacheImpl(const std::string& cache_name, |
| 145 const BoolAndErrorCallback& callback); | 146 const BoolAndErrorCallback& callback); |
| 146 | 147 |
| 147 // The DeleteCache callbacks are below. | 148 // The DeleteCache callbacks are below. |
| 148 void DeleteCacheImpl(const std::string& cache_name, | 149 void DeleteCacheImpl(const std::string& cache_name, |
| 149 const BoolAndErrorCallback& callback); | 150 const BoolAndErrorCallback& callback); |
| 150 | 151 |
| 151 void DeleteCacheDidClose(const std::string& cache_name, | 152 void DeleteCacheDidClose(const std::string& cache_name, |
| 152 const BoolAndErrorCallback& callback, | 153 const BoolAndErrorCallback& callback, |
| 153 const StringVector& ordered_cache_names, | 154 const StringVector& ordered_cache_names, |
| 155 scoped_refptr<CacheStorageCache> cache, |
| 154 int64_t cache_size); | 156 int64_t cache_size); |
| 155 void DeleteCacheDidWriteIndex(const std::string& cache_name, | 157 void DeleteCacheDidWriteIndex(const std::string& cache_name, |
| 156 const BoolAndErrorCallback& callback, | 158 const BoolAndErrorCallback& callback, |
| 157 int cache_size, | 159 int cache_size, |
| 158 bool success); | 160 bool success); |
| 159 void DeleteCacheDidCleanUp(const BoolAndErrorCallback& callback, | 161 void DeleteCacheDidCleanUp(const BoolAndErrorCallback& callback, |
| 160 bool success); | 162 bool success); |
| 161 | 163 |
| 162 // The EnumerateCache callbacks are below. | 164 // The EnumerateCache callbacks are below. |
| 163 void EnumerateCachesImpl(const StringsAndErrorCallback& callback); | 165 void EnumerateCachesImpl(const StringsAndErrorCallback& callback); |
| 164 | 166 |
| 165 // The MatchCache callbacks are below. | 167 // The MatchCache callbacks are below. |
| 166 void MatchCacheImpl(const std::string& cache_name, | 168 void MatchCacheImpl(const std::string& cache_name, |
| 167 std::unique_ptr<ServiceWorkerFetchRequest> request, | 169 std::unique_ptr<ServiceWorkerFetchRequest> request, |
| 168 const CacheStorageCache::ResponseCallback& callback); | 170 const CacheStorageCache::ResponseCallback& callback); |
| 169 void MatchCacheDidMatch(const CacheStorageCache::ResponseCallback& callback, | 171 void MatchCacheDidMatch(scoped_refptr<CacheStorageCache> cache, |
| 172 const CacheStorageCache::ResponseCallback& callback, |
| 170 CacheStorageError error, | 173 CacheStorageError error, |
| 171 std::unique_ptr<ServiceWorkerResponse> response, | 174 std::unique_ptr<ServiceWorkerResponse> response, |
| 172 std::unique_ptr<storage::BlobDataHandle> handle); | 175 std::unique_ptr<storage::BlobDataHandle> handle); |
| 173 | 176 |
| 174 // The MatchAllCaches callbacks are below. | 177 // The MatchAllCaches callbacks are below. |
| 175 void MatchAllCachesImpl(std::unique_ptr<ServiceWorkerFetchRequest> request, | 178 void MatchAllCachesImpl(std::unique_ptr<ServiceWorkerFetchRequest> request, |
| 176 const CacheStorageCache::ResponseCallback& callback); | 179 const CacheStorageCache::ResponseCallback& callback); |
| 177 void MatchAllCachesDidMatch( | 180 void MatchAllCachesDidMatch( |
| 181 scoped_refptr<CacheStorageCache> cache, |
| 178 CacheMatchResponse* out_match_response, | 182 CacheMatchResponse* out_match_response, |
| 179 const base::Closure& barrier_closure, | 183 const base::Closure& barrier_closure, |
| 180 CacheStorageError error, | 184 CacheStorageError error, |
| 181 std::unique_ptr<ServiceWorkerResponse> service_worker_response, | 185 std::unique_ptr<ServiceWorkerResponse> service_worker_response, |
| 182 std::unique_ptr<storage::BlobDataHandle> handle); | 186 std::unique_ptr<storage::BlobDataHandle> handle); |
| 183 void MatchAllCachesDidMatchAll( | 187 void MatchAllCachesDidMatchAll( |
| 184 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses, | 188 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses, |
| 185 const CacheStorageCache::ResponseCallback& callback); | 189 const CacheStorageCache::ResponseCallback& callback); |
| 186 | 190 |
| 187 void GetSizeThenCloseAllCachesImpl(const SizeCallback& callback); | 191 void GetSizeThenCloseAllCachesImpl(const SizeCallback& callback); |
| 188 | 192 |
| 189 void SizeImpl(const SizeCallback& callback); | 193 void SizeImpl(const SizeCallback& callback); |
| 190 void SizeRetrievedFromAllCaches(std::unique_ptr<int64_t> accumulator, | |
| 191 const CacheStorage::SizeCallback& callback); | |
| 192 | 194 |
| 193 void PendingClosure(const base::Closure& callback); | 195 void PendingClosure(const base::Closure& callback); |
| 194 void PendingBoolAndErrorCallback(const BoolAndErrorCallback& callback, | 196 void PendingBoolAndErrorCallback(const BoolAndErrorCallback& callback, |
| 195 bool found, | 197 bool found, |
| 196 CacheStorageError error); | 198 CacheStorageError error); |
| 197 void PendingCacheAndErrorCallback(const CacheAndErrorCallback& callback, | 199 void PendingCacheAndErrorCallback(const CacheAndErrorCallback& callback, |
| 198 scoped_refptr<CacheStorageCache> cache, | 200 scoped_refptr<CacheStorageCache> cache, |
| 199 CacheStorageError error); | 201 CacheStorageError error); |
| 200 void PendingStringsAndErrorCallback(const StringsAndErrorCallback& callback, | 202 void PendingStringsAndErrorCallback(const StringsAndErrorCallback& callback, |
| 201 const StringVector& strings, | 203 const StringVector& strings, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // without having the open the cache again. | 236 // without having the open the cache again. |
| 235 std::map<const CacheStorageCache*, scoped_refptr<CacheStorageCache>> | 237 std::map<const CacheStorageCache*, scoped_refptr<CacheStorageCache>> |
| 236 preserved_caches_; | 238 preserved_caches_; |
| 237 | 239 |
| 238 // The quota manager. | 240 // The quota manager. |
| 239 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; | 241 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; |
| 240 | 242 |
| 241 // The origin that this CacheStorage is associated with. | 243 // The origin that this CacheStorage is associated with. |
| 242 GURL origin_; | 244 GURL origin_; |
| 243 | 245 |
| 244 // Used to keep caches alive during async operations. | |
| 245 scoped_refptr<CacheStorageCache> callback_cache_; | |
| 246 std::vector<scoped_refptr<CacheStorageCache>> callback_caches_; | |
| 247 | |
| 248 base::WeakPtrFactory<CacheStorage> weak_factory_; | 246 base::WeakPtrFactory<CacheStorage> weak_factory_; |
| 249 | 247 |
| 250 DISALLOW_COPY_AND_ASSIGN(CacheStorage); | 248 DISALLOW_COPY_AND_ASSIGN(CacheStorage); |
| 251 }; | 249 }; |
| 252 | 250 |
| 253 } // namespace content | 251 } // namespace content |
| 254 | 252 |
| 255 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ | 253 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_H_ |
| OLD | NEW |