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) { |