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

Unified Diff: cc/surfaces/surface_manager.h

Issue 2520513002: Add DisplayCompositorTest. (Closed)
Patch Set: Created 4 years, 1 month 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: cc/surfaces/surface_manager.h
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h
index b52fce25adef17a8d5ac2fbe2611a20b61bc00d2..a0163579ee761b1783220b6faed22a44874a62bd 100644
--- a/cc/surfaces/surface_manager.h
+++ b/cc/surfaces/surface_manager.h
@@ -19,6 +19,7 @@
#include "cc/surfaces/frame_sink_id.h"
#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surface_observer.h"
+#include "cc/surfaces/surface_reference_manager.h"
#include "cc/surfaces/surface_sequence.h"
#include "cc/surfaces/surfaces_export.h"
@@ -28,10 +29,10 @@ class CompositorFrame;
class Surface;
class SurfaceFactoryClient;
-class CC_SURFACES_EXPORT SurfaceManager {
+class CC_SURFACES_EXPORT SurfaceManager : public SurfaceReferenceManager {
public:
SurfaceManager();
- ~SurfaceManager();
+ ~SurfaceManager() override;
void RegisterSurface(Surface* surface);
void DeregisterSurface(const SurfaceId& surface_id);
@@ -66,24 +67,6 @@ class CC_SURFACES_EXPORT SurfaceManager {
// possibly because a renderer process has crashed.
void InvalidateFrameSinkId(const FrameSinkId& frame_sink_id);
- // Adds a reference from a parent surface to a child surface. Any surface
- // embedding a child surface should have a reference added so that the child
- // surface is not garbage collected until after the parent surface.
- void AddSurfaceReference(const SurfaceId& parent_id,
- const SurfaceId& child_id);
-
- // Removes a reference from a parent surface to a child surface.
- void RemoveSurfaceReference(const SurfaceId& parent_id,
- const SurfaceId& child_id);
-
- // Returns the number of surfaces that have references to |surface_id|. When
- // the count is zero nothing is referencing the surface and it may be garbage
- // collected.
- size_t GetSurfaceReferenceCount(const SurfaceId& surface_id) const;
-
- // Returns the number of surfaces that |surface_id| has references to.
- size_t GetReferencedSurfaceCount(const SurfaceId& surface_id) const;
-
// SurfaceFactoryClient, hierarchy, and BeginFrameSource can be registered
// and unregistered in any order with respect to each other.
//
@@ -118,7 +101,14 @@ class CC_SURFACES_EXPORT SurfaceManager {
void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id,
const FrameSinkId& child_frame_sink_id);
- const SurfaceId& GetRootSurfaceId() { return kRootSurfaceId; }
+ // SurfaceReferenceManager:
+ const SurfaceId& GetRootSurfaceId() const override;
+ void AddSurfaceReference(const SurfaceId& parent_id,
+ const SurfaceId& child_id) override;
+ void RemoveSurfaceReference(const SurfaceId& parent_id,
+ const SurfaceId& child_id) override;
+ size_t GetSurfaceReferenceCount(const SurfaceId& surface_id) const override;
+ size_t GetReferencedSurfaceCount(const SurfaceId& surface_id) const override;
private:
void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id,

Powered by Google App Engine
This is Rietveld 408576698