OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_SURFACES_SURFACE_MANAGER_H_ | 5 #ifndef CC_SURFACES_SURFACE_MANAGER_H_ |
6 #define CC_SURFACES_SURFACE_MANAGER_H_ | 6 #define CC_SURFACES_SURFACE_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 }; | 52 }; |
53 | 53 |
54 explicit SurfaceManager(LifetimeType lifetime_type = LifetimeType::SEQUENCES); | 54 explicit SurfaceManager(LifetimeType lifetime_type = LifetimeType::SEQUENCES); |
55 ~SurfaceManager(); | 55 ~SurfaceManager(); |
56 | 56 |
57 #if DCHECK_IS_ON() | 57 #if DCHECK_IS_ON() |
58 // Returns a string representation of all reachable surface references. | 58 // Returns a string representation of all reachable surface references. |
59 std::string SurfaceReferencesToString(); | 59 std::string SurfaceReferencesToString(); |
60 #endif | 60 #endif |
61 | 61 |
62 void SetDependencyTracker(SurfaceDependencyTracker* dependency_tracker); | 62 void SetDependencyTracker( |
63 SurfaceDependencyTracker* dependency_tracker() { return dependency_tracker_; } | 63 std::unique_ptr<SurfaceDependencyTracker> dependency_tracker); |
| 64 SurfaceDependencyTracker* dependency_tracker() { |
| 65 return dependency_tracker_.get(); |
| 66 } |
64 | 67 |
65 void RequestSurfaceResolution(Surface* pending_surface); | 68 void RequestSurfaceResolution(Surface* pending_surface); |
66 | 69 |
67 std::unique_ptr<Surface> CreateSurface( | 70 std::unique_ptr<Surface> CreateSurface( |
68 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support, | 71 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support, |
69 const LocalSurfaceId& local_surface_id); | 72 const LocalSurfaceId& local_surface_id); |
70 | 73 |
71 // Destroy the Surface once a set of sequence numbers has been satisfied. | 74 // Destroy the Surface once a set of sequence numbers has been satisfied. |
72 void DestroySurface(std::unique_ptr<Surface> surface); | 75 void DestroySurface(std::unique_ptr<Surface> surface); |
73 | 76 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 FrameSinkManagerClient* client); | 134 FrameSinkManagerClient* client); |
132 void UnregisterFrameSinkManagerClient(const FrameSinkId& frame_sink_id); | 135 void UnregisterFrameSinkManagerClient(const FrameSinkId& frame_sink_id); |
133 | 136 |
134 // Associates a |source| with a particular namespace. That namespace and | 137 // Associates a |source| with a particular namespace. That namespace and |
135 // any children of that namespace with valid clients can potentially use | 138 // any children of that namespace with valid clients can potentially use |
136 // that |source|. | 139 // that |source|. |
137 void RegisterBeginFrameSource(BeginFrameSource* source, | 140 void RegisterBeginFrameSource(BeginFrameSource* source, |
138 const FrameSinkId& frame_sink_id); | 141 const FrameSinkId& frame_sink_id); |
139 void UnregisterBeginFrameSource(BeginFrameSource* source); | 142 void UnregisterBeginFrameSource(BeginFrameSource* source); |
140 | 143 |
141 // Returns a stable BeginFrameSource that forwards BeginFrames from the first | |
142 // available BeginFrameSource. | |
143 BeginFrameSource* GetPrimaryBeginFrameSource(); | |
144 | |
145 // Register a relationship between two namespaces. This relationship means | 144 // Register a relationship between two namespaces. This relationship means |
146 // that surfaces from the child namespace will be displayed in the parent. | 145 // that surfaces from the child namespace will be displayed in the parent. |
147 // Children are allowed to use any begin frame source that their parent can | 146 // Children are allowed to use any begin frame source that their parent can |
148 // use. | 147 // use. |
149 void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, | 148 void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, |
150 const FrameSinkId& child_frame_sink_id); | 149 const FrameSinkId& child_frame_sink_id); |
151 void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, | 150 void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, |
152 const FrameSinkId& child_frame_sink_id); | 151 const FrameSinkId& child_frame_sink_id); |
153 | 152 |
154 // Returns the top level root SurfaceId. Surfaces that are not reachable | 153 // Returns the top level root SurfaceId. Surfaces that are not reachable |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // same FrameSinkId. A SurfaceId can be reconstructed with: | 281 // same FrameSinkId. A SurfaceId can be reconstructed with: |
283 // SurfaceId surface_id(key, value[index]); | 282 // SurfaceId surface_id(key, value[index]); |
284 // The LocalSurfaceIds are stored in the order the surfaces are created in. If | 283 // The LocalSurfaceIds are stored in the order the surfaces are created in. If |
285 // a reference is added to a later SurfaceId then all temporary references up | 284 // a reference is added to a later SurfaceId then all temporary references up |
286 // to that point will be removed. This is to handle clients getting out of | 285 // to that point will be removed. This is to handle clients getting out of |
287 // sync, for example the embedded client producing new SurfaceIds faster than | 286 // sync, for example the embedded client producing new SurfaceIds faster than |
288 // the embedding client can use them. | 287 // the embedding client can use them. |
289 std::unordered_map<FrameSinkId, std::vector<LocalSurfaceId>, FrameSinkIdHash> | 288 std::unordered_map<FrameSinkId, std::vector<LocalSurfaceId>, FrameSinkIdHash> |
290 temporary_reference_ranges_; | 289 temporary_reference_ranges_; |
291 | 290 |
292 SurfaceDependencyTracker* dependency_tracker_ = nullptr; | 291 std::unique_ptr<SurfaceDependencyTracker> dependency_tracker_; |
293 | 292 |
294 base::WeakPtrFactory<SurfaceManager> weak_factory_; | 293 base::WeakPtrFactory<SurfaceManager> weak_factory_; |
295 | 294 |
296 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); | 295 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); |
297 }; | 296 }; |
298 | 297 |
299 } // namespace cc | 298 } // namespace cc |
300 | 299 |
301 #endif // CC_SURFACES_SURFACE_MANAGER_H_ | 300 #endif // CC_SURFACES_SURFACE_MANAGER_H_ |
OLD | NEW |