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

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

Issue 2179353003: [CacheStorage] Check doomed caches first when dropping cache handles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the test to work around a different bug Created 4 years, 5 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_manager_unittest.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.cc
diff --git a/content/browser/cache_storage/cache_storage.cc b/content/browser/cache_storage/cache_storage.cc
index 25c28d457a625496920b19759688163c8d3b7247..bb5269bc3e155586ad693ee1b4e4703e522efda7 100644
--- a/content/browser/cache_storage/cache_storage.cc
+++ b/content/browser/cache_storage/cache_storage.cc
@@ -182,7 +182,6 @@ class CacheStorage::MemoryLoader : public CacheStorage::CacheLoader {
}
void CleanUpDeletedCache(const std::string& cache_name) override {
- DCHECK(!ContainsKey(cache_handles_, cache_name));
}
void WriteIndex(const StringVector& cache_names,
@@ -928,21 +927,17 @@ void CacheStorage::DropCacheHandleRef(CacheStorageCache* cache) {
iter->second -= 1;
if (iter->second == 0) {
- // Delete the CacheStorageCache object. It's either in the main cache map or
- // the CacheStorage::Delete operation has run on the cache, in which case
- // it's in the doomed caches map.
- auto cache_map_iter = cache_map_.find(cache->cache_name());
-
- if (cache_map_iter == cache_map_.end()) {
- auto doomed_caches_iter = doomed_caches_.find(cache);
- DCHECK(doomed_caches_iter != doomed_caches_.end());
-
+ auto doomed_caches_iter = doomed_caches_.find(cache);
+ if (doomed_caches_iter != doomed_caches_.end()) {
// The last reference to a doomed cache is gone, perform clean up.
DeleteCacheFinalize(std::move(doomed_caches_iter->second));
doomed_caches_.erase(doomed_caches_iter);
return;
}
+ auto cache_map_iter = cache_map_.find(cache->cache_name());
+ DCHECK(cache_map_iter != cache_map_.end());
+
cache_map_iter->second.reset();
cache_handle_counts_.erase(iter);
}
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698