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

Unified Diff: content/browser/renderer_host/renderer_frame_manager.h

Issue 2358433003: Make RendererFrameManager a client of memory coordinator (Closed)
Patch Set: Use MemoryCoordinatorProxy::GetCurrentMemoryState Created 4 years, 2 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 | content/browser/renderer_host/renderer_frame_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | content/browser/renderer_host/renderer_frame_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698