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

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

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 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 0c9a85af10e9e1335df76d22b30cc8875c861830..21bcae03ffd96dafc8974aefb6de45f3103b5e38 100644
--- a/content/browser/cache_storage/cache_storage_cache.cc
+++ b/content/browser/cache_storage/cache_storage_cache.cc
@@ -443,14 +443,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;
}
@@ -1296,6 +1291,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