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

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

Issue 1470073003: [CacheStorage] Keep caches alive for 30 seconds after opening (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from PS3 Created 5 years, 1 month 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.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.h
diff --git a/content/browser/cache_storage/cache_storage.h b/content/browser/cache_storage/cache_storage.h
index 6ec3e238dd05bfe52c16906b4fb3a5833b5a5476..b2ea3876ca059e0fbd268d20154067094ce34332 100644
--- a/content/browser/cache_storage/cache_storage.h
+++ b/content/browser/cache_storage/cache_storage.h
@@ -102,6 +102,8 @@ class CONTENT_EXPORT CacheStorage {
void CompleteAsyncOperationForTesting();
private:
+ friend class TestCacheStorage;
+
class MemoryLoader;
class SimpleCacheLoader;
class CacheLoader;
@@ -113,6 +115,12 @@ class CONTENT_EXPORT CacheStorage {
scoped_refptr<CacheStorageCache> GetLoadedCache(
const std::string& cache_name);
+ // Holds a reference to a cache for thirty seconds.
+ void TemporarilyPreserveCache(const scoped_refptr<CacheStorageCache>& cache);
+ virtual void SchedulePreservedCacheRemoval(
+ const base::Closure& callback); // Virtual for testing.
+ void RemovePreservedCache(const CacheStorageCache* cache);
+
// Initializer and its callback are below.
void LazyInit();
void LazyInitImpl();
@@ -217,6 +225,11 @@ class CONTENT_EXPORT CacheStorage {
// Performs backend specific operations (memory vs disk).
scoped_ptr<CacheLoader> cache_loader_;
+ // Holds ref pointers to recently opened caches so that they can be reused
+ // without having the open the cache again.
+ std::map<const CacheStorageCache*, scoped_refptr<CacheStorageCache>>
+ preserved_caches_;
+
base::WeakPtrFactory<CacheStorage> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CacheStorage);
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698