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

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

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 side-by-side diff with in-line comments
Download patch
Index: content/browser/cache_storage/cache_storage_cache.cc
diff --git a/content/browser/cache_storage/cache_storage_cache.cc b/content/browser/cache_storage/cache_storage_cache.cc
index 2b5f17ae67cb2a39c26d5c87d96b9fe7331e37a9..c3ccda43737e40c670ed633ed0ceaec933a53afc 100644
--- a/content/browser/cache_storage/cache_storage_cache.cc
+++ b/content/browser/cache_storage/cache_storage_cache.cc
@@ -463,14 +463,9 @@ void CacheStorageCache::Size(const SizeCallback& callback) {
return;
}
- // If the cache isn't already initialized, wait for it.
if (initializing_) {
- SizeCallback pending_callback =
- base::Bind(&CacheStorageCache::PendingSizeCallback,
- weak_ptr_factory_.GetWeakPtr(), callback);
- scheduler_->ScheduleOperation(base::Bind(&CacheStorageCache::SizeImpl,
- weak_ptr_factory_.GetWeakPtr(),
- pending_callback));
+ // Note that Size doesn't use the scheduler, see header comments for why.
+ pending_size_callbacks_.push_back(callback);
return;
}
@@ -1441,6 +1436,10 @@ void CacheStorageCache::InitGotCacheSize(CacheStorageError cache_create_error,
? BACKEND_OPEN
: BACKEND_CLOSED;
+ for (const SizeCallback& callback : pending_size_callbacks_)
+ SizeImpl(callback);
+ pending_size_callbacks_.clear();
+
UMA_HISTOGRAM_ENUMERATION("ServiceWorkerCache.InitBackendResult",
cache_create_error, CACHE_STORAGE_ERROR_LAST + 1);
« no previous file with comments | « content/browser/cache_storage/cache_storage_cache.h ('k') | content/browser/cache_storage/cache_storage_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698