Index: base/memory/discardable_memory_emulated.cc |
diff --git a/base/memory/discardable_memory_emulated.cc b/base/memory/discardable_memory_emulated.cc |
index f9097b186e1405897f2a85c17f52398f0e90a1ac..340a181834ad3dbed5058cd419467f05013bc6f8 100644 |
--- a/base/memory/discardable_memory_emulated.cc |
+++ b/base/memory/discardable_memory_emulated.cc |
@@ -13,12 +13,14 @@ |
// This is admittedly pretty magical. |
const size_t kEmulatedMemoryLimit = 512 * 1024 * 1024; |
const size_t kEmulatedSoftMemoryLimit = 32 * 1024 * 1024; |
+const size_t kEmulatedBytesToKeepUnderModeratePressure = 4 * 1024 * 1024; |
const size_t kEmulatedHardMemoryLimitExpirationTimeMs = 1000; |
struct SharedState { |
SharedState() |
: manager(kEmulatedMemoryLimit, |
kEmulatedSoftMemoryLimit, |
+ kEmulatedBytesToKeepUnderModeratePressure, |
TimeDelta::FromMilliseconds( |
kEmulatedHardMemoryLimitExpirationTimeMs)) {} |
@@ -43,14 +45,18 @@ |
} |
// static |
-bool DiscardableMemoryEmulated::ReduceMemoryUsage() { |
- return g_shared_state.Pointer()->manager.ReduceMemoryUsage(); |
+void DiscardableMemoryEmulated::RegisterMemoryPressureListeners() { |
+ g_shared_state.Pointer()->manager.RegisterMemoryPressureListener(); |
} |
// static |
-void DiscardableMemoryEmulated::ReduceMemoryUsageUntilWithinLimit( |
- size_t bytes) { |
- g_shared_state.Pointer()->manager.ReduceMemoryUsageUntilWithinLimit(bytes); |
+void DiscardableMemoryEmulated::UnregisterMemoryPressureListeners() { |
+ g_shared_state.Pointer()->manager.UnregisterMemoryPressureListener(); |
+} |
+ |
+// static |
+bool DiscardableMemoryEmulated::ReduceMemoryUsage() { |
+ return g_shared_state.Pointer()->manager.ReduceMemoryUsage(); |
} |
// static |