Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(746)

Side by Side Diff: content/browser/cache_storage/cache_storage_cache.h

Issue 1957663004: [CacheStorage] Prioritize Size operations over other scheduled operations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Merge conflict fix Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest. 105 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest.
106 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors. 106 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors.
107 void Keys(const RequestsCallback& callback); 107 void Keys(const RequestsCallback& callback);
108 108
109 // Closes the backend. Future operations that require the backend 109 // Closes the backend. Future operations that require the backend
110 // will exit early. Close should only be called once per CacheStorageCache. 110 // will exit early. Close should only be called once per CacheStorageCache.
111 void Close(const base::Closure& callback); 111 void Close(const base::Closure& callback);
112 112
113 // The size of the cache's contents. This runs in parallel with other Cache 113 // The size of the cache's contents. This runs in parallel with other Cache
114 // operations. 114 // operations. This is because QuotaManager is a dependency of the Put
115 // operation and QuotaManager calls Size. If the cache isn't yet initialized,
116 // runs immediately after initialization, before any pending operations in the
117 // scheduler are run.
115 void Size(const SizeCallback& callback); 118 void Size(const SizeCallback& callback);
116 119
117 // Gets the cache's size, closes the backend, and then runs |callback| with 120 // Gets the cache's size, closes the backend, and then runs |callback| with
118 // the cache's size. 121 // the cache's size.
119 void GetSizeThenClose(const SizeCallback& callback); 122 void GetSizeThenClose(const SizeCallback& callback);
120 123
121 base::FilePath path() const { return path_; } 124 base::FilePath path() const { return path_; }
122 125
123 base::WeakPtr<CacheStorageCache> AsWeakPtr(); 126 base::WeakPtr<CacheStorageCache> AsWeakPtr();
124 127
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // Be sure to check |backend_state_| before use. 294 // Be sure to check |backend_state_| before use.
292 scoped_ptr<disk_cache::Backend> backend_; 295 scoped_ptr<disk_cache::Backend> backend_;
293 296
294 GURL origin_; 297 GURL origin_;
295 base::FilePath path_; 298 base::FilePath path_;
296 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 299 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
297 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; 300 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
298 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; 301 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
299 BackendState backend_state_ = BACKEND_UNINITIALIZED; 302 BackendState backend_state_ = BACKEND_UNINITIALIZED;
300 scoped_ptr<CacheStorageScheduler> scheduler_; 303 scoped_ptr<CacheStorageScheduler> scheduler_;
304 std::vector<SizeCallback> pending_size_callbacks_;
301 bool initializing_ = false; 305 bool initializing_ = false;
302 int64_t cache_size_ = 0; 306 int64_t cache_size_ = 0;
303 307
304 // Owns the elements of the list 308 // Owns the elements of the list
305 BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_; 309 BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_;
306 310
307 // Whether or not to store data in disk or memory. 311 // Whether or not to store data in disk or memory.
308 bool memory_only_; 312 bool memory_only_;
309 313
310 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; 314 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_;
311 315
312 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); 316 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache);
313 }; 317 };
314 318
315 } // namespace content 319 } // namespace content
316 320
317 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ 321 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698