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

Unified Diff: content/browser/dom_storage/dom_storage_context_impl.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: 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_context_impl.h
diff --git a/content/browser/dom_storage/dom_storage_context_impl.h b/content/browser/dom_storage/dom_storage_context_impl.h
index c2bbe4d42b50fcd2991e976540e64a6e1b58acc0..ad8e5d71adebb370b65dc08fcb1944ede8805dcb 100644
--- a/content/browser/dom_storage/dom_storage_context_impl.h
+++ b/content/browser/dom_storage/dom_storage_context_impl.h
@@ -15,6 +15,7 @@
#include "base/atomic_sequence_num.h"
#include "base/files/file_path.h"
#include "base/gtest_prod_util.h"
+#include "base/memory/memory_pressure_listener.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "base/time/time.h"
@@ -175,11 +176,16 @@ class CONTENT_EXPORT DOMStorageContextImpl
// unclean exit.
void StartScavengingUnusedSessionStorage();
+ // Called on the |task_runner| to purge memory in case of memory pressure.
+ void PurgeMemory(
+ base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
+
// base::trace_event::MemoryDumpProvider implementation.
bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) override;
private:
+ class DOMStorageMemoryPressureListener;
friend class DOMStorageContextImplTest;
FRIEND_TEST_ALL_PREFIXES(DOMStorageContextImplTest, Basics);
friend class base::RefCountedThreadSafe<DOMStorageContextImpl>;
@@ -238,6 +244,9 @@ class CONTENT_EXPORT DOMStorageContextImpl
// Mapping between persistent namespace IDs and namespace IDs for
// sessionStorage.
std::map<std::string, int64_t> persistent_namespace_id_to_namespace_id_;
+
+ // Notifier for memory pressure signals to purges memory.
+ DOMStorageMemoryPressureListener* leaked_memory_pressure_listener_;
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698