| Index: cc/surfaces/surface_manager.h
|
| diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h
|
| index a0163579ee761b1783220b6faed22a44874a62bd..3230fb691abba75b753ad7690396bc405540dfb0 100644
|
| --- a/cc/surfaces/surface_manager.h
|
| +++ b/cc/surfaces/surface_manager.h
|
| @@ -31,7 +31,13 @@ class SurfaceFactoryClient;
|
|
|
| class CC_SURFACES_EXPORT SurfaceManager : public SurfaceReferenceManager {
|
| public:
|
| - SurfaceManager();
|
| + enum class LifetimeType {
|
| + USE_REFERENCES,
|
| + USE_SEQUENCES,
|
| + };
|
| +
|
| + explicit SurfaceManager(
|
| + LifetimeType lifetime_type = LifetimeType::USE_SEQUENCES);
|
| ~SurfaceManager() override;
|
|
|
| void RegisterSurface(Surface* surface);
|
| @@ -120,6 +126,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 +136,9 @@ class CC_SURFACES_EXPORT SurfaceManager : public SurfaceReferenceManager {
|
| void RemoveSurfaceReferenceImpl(const SurfaceId& parent_id,
|
| const SurfaceId& child_id);
|
|
|
| + // Use reference or sequence based lifetime management.
|
| + LifetimeType lifetime_type_;
|
| +
|
| using SurfaceMap = std::unordered_map<SurfaceId, Surface*, SurfaceIdHash>;
|
| SurfaceMap surface_map_;
|
| base::ObserverList<SurfaceObserver> observer_list_;
|
| @@ -181,7 +193,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);
|
| };
|
|
|