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( | 62 void SetDependencyTracker(SurfaceDependencyTracker* dependency_tracker); |
63 std::unique_ptr<SurfaceDependencyTracker> dependency_tracker); | 63 SurfaceDependencyTracker* dependency_tracker() { return dependency_tracker_; } |
64 SurfaceDependencyTracker* dependency_tracker() { | |
65 return dependency_tracker_.get(); | |
66 } | |
67 | 64 |
68 void RequestSurfaceResolution(Surface* pending_surface); | 65 void RequestSurfaceResolution(Surface* pending_surface); |
69 | 66 |
| 67 // Creates a BeginFrameSource that tracks the first registered |
| 68 // BeginFrameSource. |
| 69 std::unique_ptr<BeginFrameSource> CreatePrimaryBeginFrameSource(); |
| 70 |
70 std::unique_ptr<Surface> CreateSurface( | 71 std::unique_ptr<Surface> CreateSurface( |
71 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support, | 72 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support, |
72 const LocalSurfaceId& local_surface_id); | 73 const LocalSurfaceId& local_surface_id); |
73 | 74 |
74 // Destroy the Surface once a set of sequence numbers has been satisfied. | 75 // Destroy the Surface once a set of sequence numbers has been satisfied. |
75 void DestroySurface(std::unique_ptr<Surface> surface); | 76 void DestroySurface(std::unique_ptr<Surface> surface); |
76 | 77 |
77 Surface* GetSurfaceForId(const SurfaceId& surface_id); | 78 Surface* GetSurfaceForId(const SurfaceId& surface_id); |
78 | 79 |
79 void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); } | 80 void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); } |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // same FrameSinkId. A SurfaceId can be reconstructed with: | 282 // same FrameSinkId. A SurfaceId can be reconstructed with: |
282 // SurfaceId surface_id(key, value[index]); | 283 // SurfaceId surface_id(key, value[index]); |
283 // The LocalSurfaceIds are stored in the order the surfaces are created in. If | 284 // The LocalSurfaceIds are stored in the order the surfaces are created in. If |
284 // a reference is added to a later SurfaceId then all temporary references up | 285 // a reference is added to a later SurfaceId then all temporary references up |
285 // to that point will be removed. This is to handle clients getting out of | 286 // to that point will be removed. This is to handle clients getting out of |
286 // sync, for example the embedded client producing new SurfaceIds faster than | 287 // sync, for example the embedded client producing new SurfaceIds faster than |
287 // the embedding client can use them. | 288 // the embedding client can use them. |
288 std::unordered_map<FrameSinkId, std::vector<LocalSurfaceId>, FrameSinkIdHash> | 289 std::unordered_map<FrameSinkId, std::vector<LocalSurfaceId>, FrameSinkIdHash> |
289 temporary_reference_ranges_; | 290 temporary_reference_ranges_; |
290 | 291 |
291 std::unique_ptr<SurfaceDependencyTracker> dependency_tracker_; | 292 SurfaceDependencyTracker* dependency_tracker_ = nullptr; |
292 | 293 |
293 base::WeakPtrFactory<SurfaceManager> weak_factory_; | 294 base::WeakPtrFactory<SurfaceManager> weak_factory_; |
294 | 295 |
295 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); | 296 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); |
296 }; | 297 }; |
297 | 298 |
298 } // namespace cc | 299 } // namespace cc |
299 | 300 |
300 #endif // CC_SURFACES_SURFACE_MANAGER_H_ | 301 #endif // CC_SURFACES_SURFACE_MANAGER_H_ |
OLD | NEW |