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

Unified Diff: cc/surfaces/surface_reference_manager.h

Issue 2520513002: Add DisplayCompositorTest. (Closed)
Patch Set: Add non-exported base. Created 4 years 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 | « cc/surfaces/surface_manager.cc ('k') | services/ui/surfaces/display_compositor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_reference_manager.h
diff --git a/cc/surfaces/surface_reference_manager.h b/cc/surfaces/surface_reference_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..66d55c67a4e96f703ed131bd4341537b90802808
--- /dev/null
+++ b/cc/surfaces/surface_reference_manager.h
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_SURFACES_SURFACE_REFERENCE_MANAGER_H_
+#define CC_SURFACES_SURFACE_REFERENCE_MANAGER_H_
+
+namespace cc {
+
+class SurfaceId;
+
+// Interface to manage surface references.
+class SurfaceReferenceManager {
+ public:
+ // Returns the top level root SurfaceId. Surfaces that are not reachable
+ // from the top level root may be garbage collected. It will not be a valid
+ // SurfaceId and will never correspond to a surface.
+ virtual const SurfaceId& GetRootSurfaceId() const = 0;
+
+ // 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.
+ virtual void AddSurfaceReference(const SurfaceId& parent_id,
+ const SurfaceId& child_id) = 0;
+
+ // Removes a reference from a parent surface to a child surface.
+ virtual void RemoveSurfaceReference(const SurfaceId& parent_id,
+ const SurfaceId& child_id) = 0;
+
+ // 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.
+ virtual size_t GetSurfaceReferenceCount(
+ const SurfaceId& surface_id) const = 0;
+
+ // Returns the number of surfaces that |surface_id| has references to.
+ virtual size_t GetReferencedSurfaceCount(
+ const SurfaceId& surface_id) const = 0;
+
+ protected:
+ virtual ~SurfaceReferenceManager() {}
+};
+
+} // namespace cc
+
+#endif // CC_SURFACES_SURFACE_REFERENCE_MANAGER_H_
« no previous file with comments | « cc/surfaces/surface_manager.cc ('k') | services/ui/surfaces/display_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698