OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 5 #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <unordered_set> | 9 #include <unordered_set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void DidReceiveCompositorFrameAck(); | 92 void DidReceiveCompositorFrameAck(); |
93 void WillDrawSurface(const LocalSurfaceId& local_surface_id, | 93 void WillDrawSurface(const LocalSurfaceId& local_surface_id, |
94 const gfx::Rect& damage_rect); | 94 const gfx::Rect& damage_rect); |
95 | 95 |
96 // BeginFrameObserver implementation. | 96 // BeginFrameObserver implementation. |
97 void OnBeginFrame(const BeginFrameArgs& args) override; | 97 void OnBeginFrame(const BeginFrameArgs& args) override; |
98 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; | 98 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
99 void OnBeginFrameSourcePausedChanged(bool paused) override; | 99 void OnBeginFrameSourcePausedChanged(bool paused) override; |
100 | 100 |
101 void UpdateNeedsBeginFramesInternal(); | 101 void UpdateNeedsBeginFramesInternal(); |
102 std::unique_ptr<Surface> CreateSurface(const SurfaceInfo& surface_info); | 102 base::WeakPtr<Surface> CreateSurface(const SurfaceInfo& surface_info); |
103 void DestroyCurrentSurface(); | |
104 | 103 |
105 CompositorFrameSinkSupportClient* const client_; | 104 CompositorFrameSinkSupportClient* const client_; |
106 | 105 |
107 SurfaceManager* surface_manager_ = nullptr; | 106 SurfaceManager* surface_manager_ = nullptr; |
108 | 107 |
109 const FrameSinkId frame_sink_id_; | 108 const FrameSinkId frame_sink_id_; |
110 | 109 |
111 // If this contains a value then a surface reference from the top-level root | 110 // If this contains a value then a surface reference from the top-level root |
112 // to SurfaceId(frame_sink_id_, referenced_local_surface_id_.value()) was | 111 // to SurfaceId(frame_sink_id_, referenced_local_surface_id_.value()) was |
113 // added. This will not contain a value if |is_root_| is false. | 112 // added. This will not contain a value if |is_root_| is false. |
114 base::Optional<LocalSurfaceId> referenced_local_surface_id_; | 113 base::Optional<LocalSurfaceId> referenced_local_surface_id_; |
115 | 114 |
116 SurfaceResourceHolder surface_resource_holder_; | 115 SurfaceResourceHolder surface_resource_holder_; |
117 | 116 |
118 std::unique_ptr<Surface> current_surface_; | 117 base::WeakPtr<Surface> current_surface_; |
| 118 |
119 // Counts the number of CompositorFrames that have been submitted and have not | 119 // Counts the number of CompositorFrames that have been submitted and have not |
120 // yet received an ACK. | 120 // yet received an ACK. |
121 int ack_pending_count_ = 0; | 121 int ack_pending_count_ = 0; |
122 ReturnedResourceArray surface_returned_resources_; | 122 ReturnedResourceArray surface_returned_resources_; |
123 | 123 |
124 // The begin frame source being observered. Null if none. | 124 // The begin frame source being observered. Null if none. |
125 BeginFrameSource* begin_frame_source_ = nullptr; | 125 BeginFrameSource* begin_frame_source_ = nullptr; |
126 | 126 |
127 // The last begin frame args generated by the begin frame source. | 127 // The last begin frame args generated by the begin frame source. |
128 BeginFrameArgs last_begin_frame_args_; | 128 BeginFrameArgs last_begin_frame_args_; |
(...skipping 21 matching lines...) Expand all Loading... |
150 const bool handles_frame_sink_id_invalidation_; | 150 const bool handles_frame_sink_id_invalidation_; |
151 | 151 |
152 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; | 152 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; |
153 | 153 |
154 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); | 154 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); |
155 }; | 155 }; |
156 | 156 |
157 } // namespace cc | 157 } // namespace cc |
158 | 158 |
159 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 159 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
OLD | NEW |