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_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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 65 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
66 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy, | 66 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy, |
67 base::WeakPtr<storage::BlobStorageContext> blob_context); | 67 base::WeakPtr<storage::BlobStorageContext> blob_context); |
68 static scoped_refptr<CacheStorageCache> CreatePersistentCache( | 68 static scoped_refptr<CacheStorageCache> CreatePersistentCache( |
69 const GURL& origin, | 69 const GURL& origin, |
70 const base::FilePath& path, | 70 const base::FilePath& path, |
71 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 71 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
72 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy, | 72 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy, |
73 base::WeakPtr<storage::BlobStorageContext> blob_context); | 73 base::WeakPtr<storage::BlobStorageContext> blob_context); |
74 | 74 |
| 75 void QueryCache(scoped_ptr<ServiceWorkerFetchRequest> request, |
| 76 const CacheStorageCacheQueryParams& options); |
| 77 |
75 // Returns ERROR_TYPE_NOT_FOUND if not found. | 78 // Returns ERROR_TYPE_NOT_FOUND if not found. |
76 void Match(scoped_ptr<ServiceWorkerFetchRequest> request, | 79 void Match(scoped_ptr<ServiceWorkerFetchRequest> request, |
77 const ResponseCallback& callback); | 80 const ResponseCallback& callback); |
78 | 81 |
79 // Returns CACHE_STORAGE_OK and matched responses in this cache. If there are | 82 // Returns CACHE_STORAGE_OK and matched responses in this cache. If there are |
80 // no responses, returns CACHE_STORAGE_OK and an empty vector. | 83 // no responses, returns CACHE_STORAGE_OK and an empty vector. |
81 void MatchAll(scoped_ptr<ServiceWorkerFetchRequest> request, | 84 void MatchAll(scoped_ptr<ServiceWorkerFetchRequest> request, |
82 const CacheStorageCacheQueryParams& match_params, | 85 const CacheStorageCacheQueryParams& match_params, |
83 const ResponsesCallback& callback); | 86 const ResponsesCallback& callback); |
84 | 87 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy, | 157 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy, |
155 base::WeakPtr<storage::BlobStorageContext> blob_context); | 158 base::WeakPtr<storage::BlobStorageContext> blob_context); |
156 | 159 |
157 // Async operations in progress will cancel and not run their callbacks. | 160 // Async operations in progress will cancel and not run their callbacks. |
158 virtual ~CacheStorageCache(); | 161 virtual ~CacheStorageCache(); |
159 | 162 |
160 // Returns true if the backend is ready to operate. | 163 // Returns true if the backend is ready to operate. |
161 bool LazyInitialize(); | 164 bool LazyInitialize(); |
162 | 165 |
163 // Returns all entries in this cache. | 166 // Returns all entries in this cache. |
| 167 void OpenEntries(scoped_ptr<ServiceWorkerFetchRequest> request, |
| 168 const CacheStorageCacheQueryParams& options, |
| 169 const OpenAllEntriesCallback& callback); |
164 void OpenAllEntries(const OpenAllEntriesCallback& callback); | 170 void OpenAllEntries(const OpenAllEntriesCallback& callback); |
165 void DidOpenNextEntry(scoped_ptr<OpenAllEntriesContext> entries_context, | 171 void DidOpenNextEntry(scoped_ptr<OpenAllEntriesContext> entries_context, |
166 const OpenAllEntriesCallback& callback, | 172 const OpenAllEntriesCallback& callback, |
167 int rv); | 173 int rv); |
| 174 void OpenEntry(scoped_ptr<ServiceWorkerFetchRequest> request, |
| 175 const OpenAllEntriesCallback& callback); |
| 176 void DidOpenEntry(scoped_ptr<OpenAllEntriesContext> entries_context, |
| 177 const OpenAllEntriesCallback& callback, |
| 178 int rv); |
168 | 179 |
169 // Match callbacks | 180 // Match callbacks |
170 void MatchImpl(scoped_ptr<ServiceWorkerFetchRequest> request, | 181 void MatchImpl(scoped_ptr<ServiceWorkerFetchRequest> request, |
171 const ResponseCallback& callback); | 182 const ResponseCallback& callback); |
172 void MatchDidOpenEntry(scoped_ptr<ServiceWorkerFetchRequest> request, | 183 void MatchDidOpenEntry(scoped_ptr<ServiceWorkerFetchRequest> request, |
173 const ResponseCallback& callback, | 184 const ResponseCallback& callback, |
174 scoped_ptr<disk_cache::Entry*> entry_ptr, | 185 scoped_ptr<disk_cache::Entry*> entry_ptr, |
175 int rv); | 186 int rv); |
176 void MatchDidReadMetadata(scoped_ptr<ServiceWorkerFetchRequest> request, | 187 void MatchDidReadMetadata(scoped_ptr<ServiceWorkerFetchRequest> request, |
177 const ResponseCallback& callback, | 188 const ResponseCallback& callback, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // size. Runs |callback| once complete. | 229 // size. Runs |callback| once complete. |
219 void UpdateCacheSize(); | 230 void UpdateCacheSize(); |
220 void UpdateCacheSizeGotSize(int current_cache_size); | 231 void UpdateCacheSizeGotSize(int current_cache_size); |
221 | 232 |
222 // Returns ERROR_NOT_FOUND if not found. Otherwise deletes and returns OK. | 233 // Returns ERROR_NOT_FOUND if not found. Otherwise deletes and returns OK. |
223 void Delete(const CacheStorageBatchOperation& operation, | 234 void Delete(const CacheStorageBatchOperation& operation, |
224 const ErrorCallback& callback); | 235 const ErrorCallback& callback); |
225 void DeleteImpl(scoped_ptr<ServiceWorkerFetchRequest> request, | 236 void DeleteImpl(scoped_ptr<ServiceWorkerFetchRequest> request, |
226 const CacheStorageCacheQueryParams& match_params, | 237 const CacheStorageCacheQueryParams& match_params, |
227 const ErrorCallback& callback); | 238 const ErrorCallback& callback); |
| 239 void DeleteDidOpenAllEntries2( |
| 240 scoped_ptr<ServiceWorkerFetchRequest> request, |
| 241 const ErrorCallback& callback, |
| 242 scoped_ptr<OpenAllEntriesContext> entries_context, |
| 243 CacheStorageError error); |
228 void DeleteDidOpenAllEntries( | 244 void DeleteDidOpenAllEntries( |
229 scoped_ptr<ServiceWorkerFetchRequest> request, | 245 scoped_ptr<ServiceWorkerFetchRequest> request, |
230 const ErrorCallback& callback, | 246 const ErrorCallback& callback, |
231 scoped_ptr<OpenAllEntriesContext> entries_context, | 247 scoped_ptr<OpenAllEntriesContext> entries_context, |
232 CacheStorageError error); | 248 CacheStorageError error); |
233 void DeleteDidOpenEntry(const GURL& origin, | 249 void DeleteDidOpenEntry(const GURL& origin, |
234 scoped_ptr<ServiceWorkerFetchRequest> request, | 250 scoped_ptr<ServiceWorkerFetchRequest> request, |
235 const CacheStorageCache::ErrorCallback& callback, | 251 const CacheStorageCache::ErrorCallback& callback, |
236 scoped_ptr<disk_cache::Entry*> entryptr, | 252 scoped_ptr<disk_cache::Entry*> entryptr, |
237 int rv); | 253 int rv); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 bool memory_only_; | 324 bool memory_only_; |
309 | 325 |
310 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; | 326 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; |
311 | 327 |
312 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); | 328 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); |
313 }; | 329 }; |
314 | 330 |
315 } // namespace content | 331 } // namespace content |
316 | 332 |
317 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ | 333 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ |
OLD | NEW |