| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest. | 107 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest. |
| 108 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors. | 108 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors. |
| 109 void Keys(const RequestsCallback& callback); | 109 void Keys(const RequestsCallback& callback); |
| 110 | 110 |
| 111 // Closes the backend. Future operations that require the backend | 111 // Closes the backend. Future operations that require the backend |
| 112 // will exit early. Close should only be called once per CacheStorageCache. | 112 // will exit early. Close should only be called once per CacheStorageCache. |
| 113 void Close(const base::Closure& callback); | 113 void Close(const base::Closure& callback); |
| 114 | 114 |
| 115 // The size of the cache's contents. This runs in parallel with other Cache | 115 // The size of the cache's contents. This runs in parallel with other Cache |
| 116 // operations. | 116 // operations. This is because QuotaManager is a dependency of the Put |
| 117 // operation and QuotaManager calls Size. If the cache isn't yet initialized, |
| 118 // runs immediately after initialization, before any pending operations in the |
| 119 // scheduler are run. |
| 117 void Size(const SizeCallback& callback); | 120 void Size(const SizeCallback& callback); |
| 118 | 121 |
| 119 // Gets the cache's size, closes the backend, and then runs |callback| with | 122 // Gets the cache's size, closes the backend, and then runs |callback| with |
| 120 // the cache's size. | 123 // the cache's size. |
| 121 void GetSizeThenClose(const SizeCallback& callback); | 124 void GetSizeThenClose(const SizeCallback& callback); |
| 122 | 125 |
| 123 base::FilePath path() const { return path_; } | 126 base::FilePath path() const { return path_; } |
| 124 | 127 |
| 125 base::WeakPtr<CacheStorageCache> AsWeakPtr(); | 128 base::WeakPtr<CacheStorageCache> AsWeakPtr(); |
| 126 | 129 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 scoped_ptr<disk_cache::Backend> backend_; | 298 scoped_ptr<disk_cache::Backend> backend_; |
| 296 | 299 |
| 297 GURL origin_; | 300 GURL origin_; |
| 298 const std::string cache_name_; | 301 const std::string cache_name_; |
| 299 base::FilePath path_; | 302 base::FilePath path_; |
| 300 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 303 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 301 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; | 304 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; |
| 302 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 305 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
| 303 BackendState backend_state_ = BACKEND_UNINITIALIZED; | 306 BackendState backend_state_ = BACKEND_UNINITIALIZED; |
| 304 scoped_ptr<CacheStorageScheduler> scheduler_; | 307 scoped_ptr<CacheStorageScheduler> scheduler_; |
| 308 std::vector<SizeCallback> pending_size_callbacks_; |
| 305 bool initializing_ = false; | 309 bool initializing_ = false; |
| 306 int64_t cache_size_ = 0; | 310 int64_t cache_size_ = 0; |
| 307 | 311 |
| 308 // Owns the elements of the list | 312 // Owns the elements of the list |
| 309 BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_; | 313 BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_; |
| 310 | 314 |
| 311 // Whether or not to store data in disk or memory. | 315 // Whether or not to store data in disk or memory. |
| 312 bool memory_only_; | 316 bool memory_only_; |
| 313 | 317 |
| 314 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; | 318 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; |
| 315 | 319 |
| 316 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); | 320 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); |
| 317 }; | 321 }; |
| 318 | 322 |
| 319 } // namespace content | 323 } // namespace content |
| 320 | 324 |
| 321 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ | 325 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ |
| OLD | NEW |