Chromium Code Reviews| 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); |
| }; |