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

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

Issue 2416713002: Write out CacheStorageCache size to index file. (Closed)
Patch Set: Consolidated observer methods, renames, cleanup, etc. Created 4 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
Index: content/browser/cache_storage/cache_storage_cache.h
diff --git a/content/browser/cache_storage/cache_storage_cache.h b/content/browser/cache_storage/cache_storage_cache.h
index 45e2e3f6d2c696621a40abbae53a567ba87b360b..4c5d5e27401ef5a6f91dd7df96624065618d8b75 100644
--- a/content/browser/cache_storage/cache_storage_cache.h
+++ b/content/browser/cache_storage/cache_storage_cache.h
@@ -33,10 +33,11 @@ class QuotaManagerProxy;
}
namespace content {
+class CacheMetadata;
class CacheStorage;
class CacheStorageBlobToDiskCache;
class CacheStorageCacheHandle;
-class CacheMetadata;
+class CacheStorageCacheObserver;
class CacheStorageScheduler;
class TestCacheStorageCache;
@@ -78,7 +79,8 @@ class CONTENT_EXPORT CacheStorageCache {
const base::FilePath& path,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy,
- base::WeakPtr<storage::BlobStorageContext> blob_context);
+ base::WeakPtr<storage::BlobStorageContext> blob_context,
+ int64_t cache_size);
// Returns ERROR_TYPE_NOT_FOUND if not found.
void Match(std::unique_ptr<ServiceWorkerFetchRequest> request,
@@ -153,6 +155,13 @@ class CONTENT_EXPORT CacheStorageCache {
std::string cache_name() const { return cache_name_; }
+ int64_t cache_size() const { return cache_size_; }
+
+ // Set the one observer that will be notified of changes to this cache.
+ // Note: Either the observer must have a lifetime longer than this instance
+ // or calling SetObserver(nullptr) to stop receiving notification of changes.
jkarlin 2016/11/11 18:24:57 s/calling/call/
cmumford 2016/11/22 17:45:03 Done.
+ void SetObserver(CacheStorageCacheObserver* observer);
+
base::WeakPtr<CacheStorageCache> AsWeakPtr();
private:
@@ -194,7 +203,8 @@ class CONTENT_EXPORT CacheStorageCache {
CacheStorage* cache_storage,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy,
- base::WeakPtr<storage::BlobStorageContext> blob_context);
+ base::WeakPtr<storage::BlobStorageContext> blob_context,
+ int64_t cache_size);
// Returns all entries in this cache.
void OpenAllEntries(const OpenAllEntriesCallback& callback);
@@ -383,8 +393,9 @@ class CONTENT_EXPORT CacheStorageCache {
BackendState backend_state_ = BACKEND_UNINITIALIZED;
std::unique_ptr<CacheStorageScheduler> scheduler_;
bool initializing_ = false;
- int64_t cache_size_ = 0;
+ int64_t cache_size_;
size_t max_query_size_bytes_;
+ CacheStorageCacheObserver* cache_observer_;
// Owns the elements of the list
BlobToDiskCacheIDMap active_blob_to_disk_cache_writers_;

Powered by Google App Engine
This is Rietveld 408576698