Index: content/browser/renderer_host/renderer_frame_manager.h |
diff --git a/content/browser/renderer_host/renderer_frame_manager.h b/content/browser/renderer_host/renderer_frame_manager.h |
index 87385481f2ea784058ddaa9f922b80cc5ea77931..061be97e3cff4cad1d98abdcbc381fcc6527ac5c 100644 |
--- a/content/browser/renderer_host/renderer_frame_manager.h |
+++ b/content/browser/renderer_host/renderer_frame_manager.h |
@@ -11,6 +11,7 @@ |
#include <map> |
#include "base/macros.h" |
+#include "base/memory/memory_coordinator_client.h" |
#include "base/memory/memory_pressure_listener.h" |
#include "base/memory/singleton.h" |
#include "content/common/content_export.h" |
@@ -31,7 +32,8 @@ class CONTENT_EXPORT RendererFrameManagerClient { |
// between a small set of tabs faster. The limit is a soft limit, because |
// clients can lock their frame to prevent it from being discarded, e.g. if the |
// tab is visible, or while capturing a screenshot. |
-class CONTENT_EXPORT RendererFrameManager { |
+class CONTENT_EXPORT RendererFrameManager : |
+ public base::MemoryCoordinatorClient { |
public: |
static RendererFrameManager* GetInstance(); |
@@ -53,18 +55,24 @@ class CONTENT_EXPORT RendererFrameManager { |
friend class RenderWidgetHostViewAuraTest; |
RendererFrameManager(); |
- ~RendererFrameManager(); |
+ ~RendererFrameManager() override; |
+ |
+ // base::MemoryCoordinatorClient implementation: |
+ void OnMemoryStateChange(base::MemoryState state) override; |
+ |
void CullUnlockedFrames(size_t saved_frame_limit); |
// React on memory pressure events to adjust the number of cached frames. |
void OnMemoryPressure( |
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
+ void PurgeMemory(int percentage); |
+ |
friend struct base::DefaultSingletonTraits<RendererFrameManager>; |
// Listens for system under pressure notifications and adjusts number of |
// cached frames accordingly. |
- base::MemoryPressureListener memory_pressure_listener_; |
+ std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
std::map<RendererFrameManagerClient*, size_t> locked_frames_; |
std::list<RendererFrameManagerClient*> unlocked_frames_; |