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

Unified Diff: components/display_compositor/frame_eviction_manager.h

Issue 2811083002: Move frame eviction into components (Closed)
Patch Set: Move features into base,and rename Created 3 years, 8 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: components/display_compositor/frame_eviction_manager.h
diff --git a/content/browser/renderer_host/renderer_frame_manager.h b/components/display_compositor/frame_eviction_manager.h
similarity index 62%
rename from content/browser/renderer_host/renderer_frame_manager.h
rename to components/display_compositor/frame_eviction_manager.h
index b8600d356efa7dcaaabd4144b27aa1750c53c181..b6f081829ba14146949fddcf9c14762af3b0d66b 100644
--- a/content/browser/renderer_host/renderer_frame_manager.h
+++ b/components/display_compositor/frame_eviction_manager.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_RENDERER_HOST_RENDERER_FRAME_MANAGER_H_
-#define CONTENT_BROWSER_RENDERER_HOST_RENDERER_FRAME_MANAGER_H_
+#ifndef COMPONENTS_DISPLAY_COMPOSITOR_FRAME_EVICTION_MANAGER_H_
+#define COMPONENTS_DISPLAY_COMPOSITOR_FRAME_EVICTION_MANAGER_H_
#include <stddef.h>
@@ -14,15 +14,13 @@
#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"
+#include "components/display_compositor/display_compositor_export.h"
-namespace content {
+namespace display_compositor {
-class RenderWidgetHostViewAuraTest;
-
-class CONTENT_EXPORT RendererFrameManagerClient {
+class DISPLAY_COMPOSITOR_EXPORT FrameEvictionManagerClient {
public:
- virtual ~RendererFrameManagerClient() {}
+ virtual ~FrameEvictionManagerClient() {}
virtual void EvictCurrentFrame() = 0;
};
@@ -32,15 +30,15 @@ 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 :
- public base::MemoryCoordinatorClient {
+class DISPLAY_COMPOSITOR_EXPORT FrameEvictionManager
+ : public base::MemoryCoordinatorClient {
public:
- static RendererFrameManager* GetInstance();
+ static FrameEvictionManager* GetInstance();
- void AddFrame(RendererFrameManagerClient*, bool locked);
- void RemoveFrame(RendererFrameManagerClient*);
- void LockFrame(RendererFrameManagerClient*);
- void UnlockFrame(RendererFrameManagerClient*);
+ void AddFrame(FrameEvictionManagerClient*, bool locked);
+ void RemoveFrame(FrameEvictionManagerClient*);
+ void LockFrame(FrameEvictionManagerClient*);
+ void UnlockFrame(FrameEvictionManagerClient*);
size_t GetMaxNumberOfSavedFrames() const;
@@ -50,38 +48,36 @@ class CONTENT_EXPORT RendererFrameManager :
}
void set_max_handles(float max_handles) { max_handles_ = max_handles; }
- private:
+ // React on memory pressure events to adjust the number of cached frames.
// Please remove when crbug.com/443824 has been fixed.
- friend class RenderWidgetHostViewAuraTest;
+ void OnMemoryPressure(
+ base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
- RendererFrameManager();
- ~RendererFrameManager() override;
+ private:
+ FrameEvictionManager();
+ ~FrameEvictionManager() override;
// base::MemoryCoordinatorClient implementation:
void OnPurgeMemory() 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>;
+ friend struct base::DefaultSingletonTraits<FrameEvictionManager>;
// Listens for system under pressure notifications and adjusts number of
// cached frames accordingly.
std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
- std::map<RendererFrameManagerClient*, size_t> locked_frames_;
- std::list<RendererFrameManagerClient*> unlocked_frames_;
+ std::map<FrameEvictionManagerClient*, size_t> locked_frames_;
+ std::list<FrameEvictionManagerClient*> unlocked_frames_;
size_t max_number_of_saved_frames_;
float max_handles_;
- DISALLOW_COPY_AND_ASSIGN(RendererFrameManager);
+ DISALLOW_COPY_AND_ASSIGN(FrameEvictionManager);
};
-} // namespace content
+} // namespace display_compositor
-#endif // CONTENT_BROWSER_RENDERER_HOST_RENDERER_FRAME_MANAGER_H_
+#endif // COMPONENTS_DISPLAY_COMPOSITOR_FRAME_EVICTION_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698