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

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

Issue 1681653002: [CacheStorage] Use backend size to determine change in cache size in put and delete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run callbacks immediately Created 4 years, 10 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
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3dd232937dfb588a9d06bbfad86112b9630283c4..b96612fee5cb2a600654338a42ed5dc5eade52fa 100644
--- a/content/browser/cache_storage/cache_storage_cache.h
+++ b/content/browser/cache_storage/cache_storage_cache.h
@@ -207,18 +207,22 @@ class CONTENT_EXPORT CacheStorageCache
disk_cache::ScopedEntryPtr entry,
bool success);
+ // Asynchronously calculates the current cache size, notifies the quota
+ // manager of any change from the last report, and sets cache_size_ to the new
+ // size. Runs |callback| once complete.
+ void UpdateCacheSize();
+ void UpdateCacheSizeGotSize(int current_cache_size);
+
// Returns ERROR_NOT_FOUND if not found. Otherwise deletes and returns OK.
void Delete(const CacheStorageBatchOperation& operation,
const ErrorCallback& callback);
void DeleteImpl(scoped_ptr<ServiceWorkerFetchRequest> request,
const ErrorCallback& callback);
- void DeleteDidOpenEntry(
- const GURL& origin,
- scoped_ptr<ServiceWorkerFetchRequest> request,
- const CacheStorageCache::ErrorCallback& callback,
- scoped_ptr<disk_cache::Entry*> entryptr,
- const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy,
- int rv);
+ void DeleteDidOpenEntry(const GURL& origin,
+ scoped_ptr<ServiceWorkerFetchRequest> request,
+ const CacheStorageCache::ErrorCallback& callback,
+ scoped_ptr<disk_cache::Entry*> entryptr,
+ int rv);
// Keys callbacks.
void KeysImpl(const RequestsCallback& callback);
@@ -243,7 +247,8 @@ class CONTENT_EXPORT CacheStorageCache
int rv);
void InitBackend();
- void InitDone(CacheStorageError error);
+ void InitDidCreateBackend(CacheStorageError cache_create_error);
+ void InitGotCacheSize(CacheStorageError cache_create_error, int cache_size);
void PendingClosure(const base::Closure& callback);
void PendingErrorCallback(const ErrorCallback& callback,
@@ -276,9 +281,10 @@ class CONTENT_EXPORT CacheStorageCache
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
- BackendState backend_state_;
+ BackendState backend_state_ = BACKEND_UNINITIALIZED;
scoped_ptr<CacheStorageScheduler> scheduler_;
- bool initializing_;
+ bool initializing_ = false;
+ int64_t cache_size_ = 0;
// Owns the elements of the list
BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_;
« 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