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

Unified Diff: content/browser/dom_storage/dom_storage_namespace.h

Issue 1953703004: Purge browser cache for dom storage in a smarter way (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dom_storage
Patch Set: Fix limit and description for UMA. 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/dom_storage/dom_storage_namespace.h
diff --git a/content/browser/dom_storage/dom_storage_namespace.h b/content/browser/dom_storage/dom_storage_namespace.h
index f572284d5aea7f1484b768884f55f311e63c3d58..8f75f2ab8256ffff4483587237fb723b96c562f7 100644
--- a/content/browser/dom_storage/dom_storage_namespace.h
+++ b/content/browser/dom_storage/dom_storage_namespace.h
@@ -32,14 +32,11 @@ class SessionStorageDatabase;
class CONTENT_EXPORT DOMStorageNamespace
: public base::RefCountedThreadSafe<DOMStorageNamespace> {
public:
- // Option for PurgeMemory.
- enum PurgeOption {
- // Purge unopened areas only.
- PURGE_UNOPENED,
-
- // Purge aggressively, i.e. discard cache even for areas that have
- // non-zero open count.
- PURGE_AGGRESSIVE,
+ // Struct to hold statistics about the areas in the namespace.
+ struct UsageStatistics {
+ size_t total_cache_size;
+ unsigned total_area_count;
+ unsigned inactive_area_count; // areas with open count 0.
};
// Constructor for a LocalStorage namespace with id of 0
@@ -76,11 +73,12 @@ class CONTENT_EXPORT DOMStorageNamespace
void DeleteLocalStorageOrigin(const GURL& origin);
void DeleteSessionStorageOrigin(const GURL& origin);
- void PurgeMemory(PurgeOption purge);
+ void PurgeMemory(bool aggressively);
void Shutdown();
void Flush();
- unsigned int CountInMemoryAreas() const;
+ // Returns statistics about the areas in the namespace.
+ UsageStatistics GetUsageStatistics() const;
// Adds memory statistics to |pmd| for chrome://tracing.
void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd);
« no previous file with comments | « content/browser/dom_storage/dom_storage_host.cc ('k') | content/browser/dom_storage/dom_storage_namespace.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698