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

Unified Diff: content/browser/dom_storage/dom_storage_context_impl.cc

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: Fixes. 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.cc
diff --git a/content/browser/dom_storage/dom_storage_context_impl.cc b/content/browser/dom_storage/dom_storage_context_impl.cc
index 1e6afa770e521e38a77f85825d066a4760759e4e..469e71f35b423e9b6d1c3092d895e98c65a2499f 100644
--- a/content/browser/dom_storage/dom_storage_context_impl.cc
+++ b/content/browser/dom_storage/dom_storage_context_impl.cc
@@ -396,6 +396,19 @@ void DOMStorageContextImpl::StartScavengingUnusedSessionStorage() {
}
}
+void DOMStorageContextImpl::OnMemoryPressure(
+ base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
+ if (is_shutdown_)
+ return;
+
+ DOMStorageNamespace::PurgeOption option = DOMStorageNamespace::PURGE_UNOPENED;
+ if (memory_pressure_level ==
+ base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL)
+ option = DOMStorageNamespace::PURGE_AGGRESSIVE;
+ for (const auto& it : namespaces_)
+ it.second->PurgeMemory(option);
+}
+
bool DOMStorageContextImpl::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) {

Powered by Google App Engine
This is Rietveld 408576698