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

Unified Diff: base/memory/discardable_memory_emulated.cc

Issue 448173002: Re-land: base: Introduce an explicit call for reducing emulated discardable memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable EmulatedDiscardableMemoryDiscardedWhenWidgetsHidden with lsan 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 340a181834ad3dbed5058cd419467f05013bc6f8..f9097b186e1405897f2a85c17f52398f0e90a1ac 100644
--- a/base/memory/discardable_memory_emulated.cc
+++ b/base/memory/discardable_memory_emulated.cc
@@ -13,14 +13,12 @@ namespace {
// 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)) {}
@@ -45,18 +43,14 @@ DiscardableMemoryEmulated::~DiscardableMemoryEmulated() {
}
// static
-void DiscardableMemoryEmulated::RegisterMemoryPressureListeners() {
- g_shared_state.Pointer()->manager.RegisterMemoryPressureListener();
-}
-
-// static
-void DiscardableMemoryEmulated::UnregisterMemoryPressureListeners() {
- g_shared_state.Pointer()->manager.UnregisterMemoryPressureListener();
+bool DiscardableMemoryEmulated::ReduceMemoryUsage() {
+ return g_shared_state.Pointer()->manager.ReduceMemoryUsage();
}
// static
-bool DiscardableMemoryEmulated::ReduceMemoryUsage() {
- return g_shared_state.Pointer()->manager.ReduceMemoryUsage();
+void DiscardableMemoryEmulated::ReduceMemoryUsageUntilWithinLimit(
+ size_t bytes) {
+ g_shared_state.Pointer()->manager.ReduceMemoryUsageUntilWithinLimit(bytes);
}
// 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