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

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

Issue 1916473002: [CacheStorage] Prioritize Size operations over other scheduled operations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest. 123 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest.
124 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors. 124 // Returns CACHE_STORAGE_OK and a vector of requests if there are no errors.
125 void Keys(const RequestsCallback& callback); 125 void Keys(const RequestsCallback& callback);
126 126
127 // Closes the backend. Future operations that require the backend 127 // Closes the backend. Future operations that require the backend
128 // will exit early. Close should only be called once per CacheStorageCache. 128 // will exit early. Close should only be called once per CacheStorageCache.
129 void Close(const base::Closure& callback); 129 void Close(const base::Closure& callback);
130 130
131 // The size of the cache's contents. This runs in parallel with other Cache 131 // The size of the cache's contents. This runs in parallel with other Cache
132 // operations. 132 // operations. This is because QuotaManager is a dependency of the Put
133 // operation and QuotaManager calls Size. If the cache isn't yet initialized,
134 // runs immediately after initialization, before any pending operations in the
135 // scheduler are run.
133 void Size(const SizeCallback& callback); 136 void Size(const SizeCallback& callback);
134 137
135 // Gets the cache's size, closes the backend, and then runs |callback| with 138 // Gets the cache's size, closes the backend, and then runs |callback| with
136 // the cache's size. 139 // the cache's size.
137 void GetSizeThenClose(const SizeCallback& callback); 140 void GetSizeThenClose(const SizeCallback& callback);
138 141
139 base::FilePath path() const { return path_; } 142 base::FilePath path() const { return path_; }
140 143
141 base::WeakPtr<CacheStorageCache> AsWeakPtr(); 144 base::WeakPtr<CacheStorageCache> AsWeakPtr();
142 145
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 std::unique_ptr<disk_cache::Backend> backend_; 347 std::unique_ptr<disk_cache::Backend> backend_;
345 348
346 GURL origin_; 349 GURL origin_;
347 const std::string cache_name_; 350 const std::string cache_name_;
348 base::FilePath path_; 351 base::FilePath path_;
349 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 352 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
350 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; 353 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
351 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; 354 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
352 BackendState backend_state_ = BACKEND_UNINITIALIZED; 355 BackendState backend_state_ = BACKEND_UNINITIALIZED;
353 std::unique_ptr<CacheStorageScheduler> scheduler_; 356 std::unique_ptr<CacheStorageScheduler> scheduler_;
357 std::vector<SizeCallback> pending_size_callbacks_;
354 bool initializing_ = false; 358 bool initializing_ = false;
355 int64_t cache_size_ = 0; 359 int64_t cache_size_ = 0;
356 360
357 // Owns the elements of the list 361 // Owns the elements of the list
358 BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_; 362 BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_;
359 363
360 // Whether or not to store data in disk or memory. 364 // Whether or not to store data in disk or memory.
361 bool memory_only_; 365 bool memory_only_;
362 366
363 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_; 367 base::WeakPtrFactory<CacheStorageCache> weak_ptr_factory_;
364 368
365 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache); 369 DISALLOW_COPY_AND_ASSIGN(CacheStorageCache);
366 }; 370 };
367 371
368 } // namespace content 372 } // namespace content
369 373
370 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_CACHE_H_ 374 #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