| Index: cc/surfaces/surface_manager.h
|
| diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h
|
| index 9e6144bf6879252c5b53fe90f5fdbf4c872a39bc..5dd3bb2bfb162bc1b61589d27319754afcf10b38 100644
|
| --- a/cc/surfaces/surface_manager.h
|
| +++ b/cc/surfaces/surface_manager.h
|
| @@ -33,7 +33,12 @@ class SurfaceFactoryClient;
|
| class CC_SURFACES_EXPORT SurfaceManager
|
| : public NON_EXPORTED_BASE(SurfaceReferenceManager) {
|
| public:
|
| - SurfaceManager();
|
| + enum class LifetimeType {
|
| + REFERENCES,
|
| + SEQUENCES,
|
| + };
|
| +
|
| + explicit SurfaceManager(LifetimeType lifetime_type = LifetimeType::SEQUENCES);
|
| ~SurfaceManager() override;
|
|
|
| void RegisterSurface(Surface* surface);
|
| @@ -122,6 +127,9 @@ class CC_SURFACES_EXPORT SurfaceManager
|
| 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
|
| @@ -129,6 +137,9 @@ class CC_SURFACES_EXPORT SurfaceManager
|
| 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_;
|
| @@ -183,7 +194,7 @@ class CC_SURFACES_EXPORT SurfaceManager
|
|
|
| // 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);
|
| };
|
|
|