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

Unified Diff: cc/surfaces/surface_manager.h

Issue 2540783004: Add SurfaceManager option to use references exclusively. (Closed)
Patch Set: 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 | « no previous file | cc/surfaces/surface_manager.cc » ('j') | cc/surfaces/surface_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_manager.h
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h
index a0163579ee761b1783220b6faed22a44874a62bd..25269c546776f6bfbe42253b0104e2996946038d 100644
--- a/cc/surfaces/surface_manager.h
+++ b/cc/surfaces/surface_manager.h
@@ -31,7 +31,7 @@ class SurfaceFactoryClient;
class CC_SURFACES_EXPORT SurfaceManager : public SurfaceReferenceManager {
public:
- SurfaceManager();
+ explicit SurfaceManager(bool use_references = false);
vmpstr 2016/12/01 21:04:02 minor nit: we'll either have to put comments every
kylechar 2016/12/01 22:49:58 Done.
~SurfaceManager() override;
void RegisterSurface(Surface* surface);
@@ -120,6 +120,9 @@ class CC_SURFACES_EXPORT SurfaceManager : public SurfaceReferenceManager {
bool ChildContains(const FrameSinkId& child_frame_sink_id,
const FrameSinkId& search_frame_sink_id) const;
+ // Garbage collects all destroyed surfaces not reachable from the root. Used
+ // when |use_references_| is true.
+ void GarbageCollectSurfacesFromRoot();
void GarbageCollectSurfaces();
// Removes reference from a parent surface to a child surface. Used to remove
@@ -127,6 +130,9 @@ class CC_SURFACES_EXPORT SurfaceManager : public SurfaceReferenceManager {
void RemoveSurfaceReferenceImpl(const SurfaceId& parent_id,
const SurfaceId& child_id);
+ // Use surface reference based lifetime management.
+ bool use_references_;
+
using SurfaceMap = std::unordered_map<SurfaceId, Surface*, SurfaceIdHash>;
SurfaceMap surface_map_;
base::ObserverList<SurfaceObserver> observer_list_;
@@ -181,7 +187,7 @@ class CC_SURFACES_EXPORT SurfaceManager : public SurfaceReferenceManager {
// Root SurfaceId that references display root surfaces. There is no Surface
// with this id, it's for bookkeeping purposes only.
- const SurfaceId kRootSurfaceId;
+ const SurfaceId root_surface_id_;
DISALLOW_COPY_AND_ASSIGN(SurfaceManager);
};
« no previous file with comments | « no previous file | cc/surfaces/surface_manager.cc » ('j') | cc/surfaces/surface_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698