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 17 matching lines...) Expand all Loading... |
28 #include "cc/surfaces/surface_reference_factory.h" | 28 #include "cc/surfaces/surface_reference_factory.h" |
29 #include "cc/surfaces/surface_sequence.h" | 29 #include "cc/surfaces/surface_sequence.h" |
30 #include "cc/surfaces/surfaces_export.h" | 30 #include "cc/surfaces/surfaces_export.h" |
31 | 31 |
32 #if DCHECK_IS_ON() | 32 #if DCHECK_IS_ON() |
33 #include <iosfwd> | 33 #include <iosfwd> |
34 #include <string> | 34 #include <string> |
35 #endif | 35 #endif |
36 | 36 |
37 namespace cc { | 37 namespace cc { |
| 38 |
| 39 struct BeginFrameAck; |
| 40 struct BeginFrameArgs; |
38 class BeginFrameSource; | 41 class BeginFrameSource; |
39 class CompositorFrame; | 42 class CompositorFrame; |
40 class FrameSinkManagerClient; | 43 class FrameSinkManagerClient; |
41 class Surface; | 44 class Surface; |
42 | 45 |
43 namespace test { | 46 namespace test { |
44 class SurfaceSynchronizationTest; | 47 class SurfaceSynchronizationTest; |
45 } | 48 } |
46 | 49 |
47 class CC_SURFACES_EXPORT SurfaceManager { | 50 class CC_SURFACES_EXPORT SurfaceManager { |
(...skipping 24 matching lines...) Expand all Loading... |
72 void DestroySurface(std::unique_ptr<Surface> surface); | 75 void DestroySurface(std::unique_ptr<Surface> surface); |
73 | 76 |
74 Surface* GetSurfaceForId(const SurfaceId& surface_id); | 77 Surface* GetSurfaceForId(const SurfaceId& surface_id); |
75 | 78 |
76 void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); } | 79 void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); } |
77 | 80 |
78 void RemoveObserver(SurfaceObserver* obs) { | 81 void RemoveObserver(SurfaceObserver* obs) { |
79 observer_list_.RemoveObserver(obs); | 82 observer_list_.RemoveObserver(obs); |
80 } | 83 } |
81 | 84 |
82 bool SurfaceModified(const SurfaceId& surface_id); | 85 // Called when a Surface is modified, e.g. when a CompositorFrame is |
| 86 // activated, its producer confirms that no CompositorFrame will be submitted |
| 87 // in response to a BeginFrame, or a CopyOutputRequest is issued. |
| 88 // |
| 89 // |ack.sequence_number| is only valid if called in response to a BeginFrame. |
| 90 bool SurfaceModified(const SurfaceId& surface_id, const BeginFrameAck& ack); |
83 | 91 |
84 // Called when a CompositorFrame is submitted to a CompositorFrameSinkSupport | 92 // Called when a CompositorFrame is submitted to a CompositorFrameSinkSupport |
85 // for a given |surface_id| for the first time. | 93 // for a given |surface_id| for the first time. |
86 void SurfaceCreated(const SurfaceInfo& surface_info); | 94 void SurfaceCreated(const SurfaceInfo& surface_info); |
87 | 95 |
88 // Called when a CompositorFrame within |surface| has activated. | 96 // Called when a CompositorFrame within |surface| has activated. |
89 void SurfaceActivated(Surface* surface); | 97 void SurfaceActivated(Surface* surface); |
90 | 98 |
91 // Called when the dependencies of a pending CompositorFrame within |surface| | 99 // Called when the dependencies of a pending CompositorFrame within |surface| |
92 // has changed. | 100 // has changed. |
93 void SurfaceDependenciesChanged( | 101 void SurfaceDependenciesChanged( |
94 Surface* surface, | 102 Surface* surface, |
95 const base::flat_set<SurfaceId>& added_dependencies, | 103 const base::flat_set<SurfaceId>& added_dependencies, |
96 const base::flat_set<SurfaceId>& removed_dependencies); | 104 const base::flat_set<SurfaceId>& removed_dependencies); |
97 | 105 |
98 // Called when |surface| is being destroyed. | 106 // Called when |surface| is being destroyed. |
99 void SurfaceDiscarded(Surface* surface); | 107 void SurfaceDiscarded(Surface* surface); |
100 | 108 |
| 109 // Called when a Surface's CompositorFrame producer has received a BeginFrame |
| 110 // and, thus, is expected to produce damage soon. |
| 111 void SurfaceDamageExpected(const SurfaceId& surface_id, |
| 112 const BeginFrameArgs& args); |
| 113 |
101 // Require that the given sequence number must be satisfied (using | 114 // Require that the given sequence number must be satisfied (using |
102 // SatisfySequence) before the given surface can be destroyed. | 115 // SatisfySequence) before the given surface can be destroyed. |
103 void RequireSequence(const SurfaceId& surface_id, | 116 void RequireSequence(const SurfaceId& surface_id, |
104 const SurfaceSequence& sequence); | 117 const SurfaceSequence& sequence); |
105 | 118 |
106 // Satisfies the given sequence number. Once all sequence numbers that | 119 // Satisfies the given sequence number. Once all sequence numbers that |
107 // a surface depends on are satisfied, the surface can be destroyed. | 120 // a surface depends on are satisfied, the surface can be destroyed. |
108 void SatisfySequence(const SurfaceSequence& sequence); | 121 void SatisfySequence(const SurfaceSequence& sequence); |
109 | 122 |
110 void RegisterFrameSinkId(const FrameSinkId& frame_sink_id); | 123 void RegisterFrameSinkId(const FrameSinkId& frame_sink_id); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 SurfaceDependencyTracker* dependency_tracker_ = nullptr; | 305 SurfaceDependencyTracker* dependency_tracker_ = nullptr; |
293 | 306 |
294 base::WeakPtrFactory<SurfaceManager> weak_factory_; | 307 base::WeakPtrFactory<SurfaceManager> weak_factory_; |
295 | 308 |
296 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); | 309 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); |
297 }; | 310 }; |
298 | 311 |
299 } // namespace cc | 312 } // namespace cc |
300 | 313 |
301 #endif // CC_SURFACES_SURFACE_MANAGER_H_ | 314 #endif // CC_SURFACES_SURFACE_MANAGER_H_ |
OLD | NEW |