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

Unified Diff: content/common/host_discardable_shared_memory_manager.cc

Issue 944823007: content: Improve HostDiscardableSharedMemoryManager's memory pressure handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/host_discardable_shared_memory_manager.cc
diff --git a/content/common/host_discardable_shared_memory_manager.cc b/content/common/host_discardable_shared_memory_manager.cc
index c428bc5fe3473b7204ef87f8846f2aa45ac42c3c..fb71349c10477d4ffc2e5151586dc54de9d5d1f6 100644
--- a/content/common/host_discardable_shared_memory_manager.cc
+++ b/content/common/host_discardable_shared_memory_manager.cc
@@ -159,7 +159,10 @@ void HostDiscardableSharedMemoryManager::OnMemoryPressure(
switch (memory_pressure_level) {
case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
+ break;
case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
+ // Purge memory until usage is within half of |memory_limit_|.
+ ReduceMemoryUsageUntilWithinLimit(memory_limit_ / 2);
break;
case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL:
// Purge everything possible when pressure is critical.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698