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

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

Issue 2727703002: [CacheStorageCache] Close Entry* if the CacheStorageCache is gone (Closed)
Patch Set: Nit Created 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 162b93c2595fc864901524025a96cea59c192b0b..0216276f842073ab6a5b398f8b038f69c02fb617 100644
--- a/content/browser/cache_storage/cache_storage_cache.cc
+++ b/content/browser/cache_storage/cache_storage_cache.cc
@@ -292,6 +292,16 @@ struct CacheStorageCache::QueryCacheContext {
callback(callback),
matches(base::MakeUnique<QueryCacheResults>()) {}
+ ~QueryCacheContext() {
+ // If the CacheStorageCache is deleted before a backend operation to open
+ // an entry completes, the callback won't be run and the resulting entry
+ // will be leaked unless we close it here.
+ if (enumerated_entry) {
+ enumerated_entry->Close();
+ enumerated_entry = nullptr;
+ }
+ }
+
// Input to QueryCache
std::unique_ptr<ServiceWorkerFetchRequest> request;
CacheStorageCacheQueryParams options;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698