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

Unified Diff: base/memory/discardable_memory_emulated.cc

Issue 458343003: Revert of base: Introduce an explicit call for reducing emulated discardable memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « base/memory/discardable_memory_emulated.h ('k') | base/memory/discardable_memory_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « base/memory/discardable_memory_emulated.h ('k') | base/memory/discardable_memory_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698