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

Unified Diff: base/memory/discardable_memory.h

Issue 336273003: base: Add soft memory limit to DiscardableMemoryManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac build Created 6 years, 5 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 | base/memory/discardable_memory_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory.h
diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h
index 9189b5eb027901a0e6e22d87853cd928b0c9fb4b..d16ed3e8480f933725c7f9a25444ff72c2320512 100644
--- a/base/memory/discardable_memory.h
+++ b/base/memory/discardable_memory.h
@@ -97,6 +97,16 @@ class BASE_EXPORT DiscardableMemory {
// Create a DiscardableMemory instance with preferred type and |size|.
static scoped_ptr<DiscardableMemory> CreateLockedMemory(size_t size);
+ // Discardable memory implementations might allow an elevated usage level
+ // while in frequent use. Call this to have the usage reduced to the base
+ // level. Returns true if there's no need to call this again until
+ // memory instances have been used. This indicates that all discardable
+ // memory implementations have reduced usage to the base level or below.
+ // Note: calling this too often or while discardable memory is in frequent
+ // use can hurt performance, whereas calling it too infrequently can result
+ // in memory bloat.
+ static bool ReduceMemoryUsage();
+
// Locks the memory so that it will not be purged by the system. Returns
// DISCARDABLE_MEMORY_LOCK_STATUS_SUCCESS on success. If the return value is
// DISCARDABLE_MEMORY_LOCK_STATUS_FAILED then this object should be
« no previous file with comments | « no previous file | base/memory/discardable_memory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698