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

Unified Diff: content/browser/cache_storage/cache_storage_cache.h

Issue 2085583002: [CacheStorage] Don't call GetUsageAndQuota from a scheduled operation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/cache_storage/cache_storage_cache.h
diff --git a/content/browser/cache_storage/cache_storage_cache.h b/content/browser/cache_storage/cache_storage_cache.h
index 879cae2bc751d014ad2f32b55b49713c0f70382a..4b3a72e3207b4259ba5e57bbd24bad527d7b9573 100644
--- a/content/browser/cache_storage/cache_storage_cache.h
+++ b/content/browser/cache_storage/cache_storage_cache.h
@@ -41,8 +41,8 @@ class TestCacheStorageCache;
// Represents a ServiceWorker Cache as seen in
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ The
-// asynchronous methods are executed serially (except for Size). Callbacks to
-// the public functions will be called so long as the cache object lives.
+// asynchronous methods are executed serially. Callbacks to the public functions
+// will be called so long as the cache object lives.
class CONTENT_EXPORT CacheStorageCache
: public base::RefCounted<CacheStorageCache> {
public:
@@ -115,6 +115,13 @@ class CONTENT_EXPORT CacheStorageCache
// http://crbug.com/486637
void BatchOperation(const std::vector<CacheStorageBatchOperation>& operations,
const ErrorCallback& callback);
+ void BatchDidGetUsageAndQuota(
+ const std::vector<CacheStorageBatchOperation>& operations,
+ const ErrorCallback& callback,
+ int64_t space_required,
+ storage::QuotaStatusCode status_code,
+ int64_t usage,
+ int64_t quota);
void BatchDidOneOperation(const base::Closure& barrier_closure,
ErrorCallback* callback,
CacheStorageError error);
@@ -128,11 +135,7 @@ class CONTENT_EXPORT CacheStorageCache
// will exit early. Close should only be called once per CacheStorageCache.
void Close(const base::Closure& callback);
- // The size of the cache's contents. This runs in parallel with other Cache
- // operations. This is because QuotaManager is a dependency of the Put
- // operation and QuotaManager calls Size. If the cache isn't yet initialized,
- // runs immediately after initialization, before any pending operations in the
- // scheduler are run.
+ // The size of the cache's contents.
void Size(const SizeCallback& callback);
// Gets the cache's size, closes the backend, and then runs |callback| with
@@ -213,6 +216,15 @@ class CONTENT_EXPORT CacheStorageCache
std::unique_ptr<CacheMetadata> metadata);
// WriteSideData callbacks
+ void WriteSideDataDidGetQuota(const ErrorCallback& callback,
+ const GURL& url,
+ base::Time expected_response_time,
+ scoped_refptr<net::IOBuffer> buffer,
+ int buf_len,
+ storage::QuotaStatusCode status_code,
+ int64_t usage,
+ int64_t quota);
+
void WriteSideDataImpl(const ErrorCallback& callback,
const GURL& url,
base::Time expected_response_time,
@@ -354,7 +366,6 @@ class CONTENT_EXPORT CacheStorageCache
base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
BackendState backend_state_ = BACKEND_UNINITIALIZED;
std::unique_ptr<CacheStorageScheduler> scheduler_;
- std::vector<SizeCallback> pending_size_callbacks_;
bool initializing_ = false;
int64_t cache_size_ = 0;

Powered by Google App Engine
This is Rietveld 408576698