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

Unified Diff: base/memory/discardable_memory_manager.h

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: 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
Index: base/memory/discardable_memory_manager.h
diff --git a/base/memory/discardable_memory_manager.h b/base/memory/discardable_memory_manager.h
index a61f141c43034ecb5f1cfcec5033b8d431d884d8..8958e9d13038c08c0c4f5c01c901c3b17c4d1a73 100644
--- a/base/memory/discardable_memory_manager.h
+++ b/base/memory/discardable_memory_manager.h
@@ -8,7 +8,6 @@
#include "base/base_export.h"
#include "base/containers/hash_tables.h"
#include "base/containers/mru_cache.h"
-#include "base/memory/memory_pressure_listener.h"
#include "base/synchronization/lock.h"
#include "base/time/time.h"
@@ -74,13 +73,6 @@ class BASE_EXPORT_PRIVATE DiscardableMemoryManager {
TimeDelta hard_memory_limit_expiration_time);
virtual ~DiscardableMemoryManager();
- // Call this to register memory pressure listener. Must be called on a thread
- // with a MessageLoop current.
- void RegisterMemoryPressureListener();
-
- // Call this to unregister memory pressure listener.
- void UnregisterMemoryPressureListener();
-
// The maximum number of bytes of memory that may be allocated before we force
// a purge.
void SetMemoryLimit(size_t bytes);
@@ -101,6 +93,10 @@ class BASE_EXPORT_PRIVATE DiscardableMemoryManager {
// have been used.
bool ReduceMemoryUsage();
+ // This can be called to attempt to reduce memory footprint until within
+ // limit for bytes to keep under moderate pressure.
+ void ReduceMemoryUsageUntilWithinModeratePressureLimit();
+
// Adds the given allocation to the manager's collection.
void Register(Allocation* allocation, size_t bytes);
@@ -141,10 +137,6 @@ class BASE_EXPORT_PRIVATE DiscardableMemoryManager {
};
typedef HashingMRUCache<Allocation*, AllocationInfo> AllocationMap;
- // This can be called as a hint that the system is under memory pressure.
- void OnMemoryPressure(
- MemoryPressureListener::MemoryPressureLevel pressure_level);
-
// Purges memory until usage is less or equal to
// |bytes_to_keep_under_moderate_pressure_|.
void PurgeUntilWithinBytesToKeepUnderModeratePressure();
@@ -189,10 +181,6 @@ class BASE_EXPORT_PRIVATE DiscardableMemoryManager {
// this limit.
size_t bytes_to_keep_under_moderate_pressure_;
- // Allows us to be respond when the system reports that it is under memory
- // pressure.
- scoped_ptr<MemoryPressureListener> memory_pressure_listener_;
-
// Amount of time it takes for an allocation to become affected by
// |soft_memory_limit_|.
TimeDelta hard_memory_limit_expiration_time_;

Powered by Google App Engine
This is Rietveld 408576698