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 #include "cc/surfaces/compositor_frame_sink_support.h" | 5 #include "cc/surfaces/compositor_frame_sink_support.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (begin_frame_source_) | 118 if (begin_frame_source_) |
119 begin_frame_source_->DidFinishFrame(this, ack); | 119 begin_frame_source_->DidFinishFrame(this, ack); |
120 } | 120 } |
121 | 121 |
122 void CompositorFrameSinkSupport::SubmitCompositorFrame( | 122 void CompositorFrameSinkSupport::SubmitCompositorFrame( |
123 const LocalSurfaceId& local_surface_id, | 123 const LocalSurfaceId& local_surface_id, |
124 CompositorFrame frame) { | 124 CompositorFrame frame) { |
125 DCHECK(surface_factory_); | 125 DCHECK(surface_factory_); |
126 ++ack_pending_count_; | 126 ++ack_pending_count_; |
127 | 127 |
128 if (frame.metadata.begin_frame_ack.sequence_number < | 128 DCHECK_GE(frame.metadata.begin_frame_ack.sequence_number, |
129 BeginFrameArgs::kStartingFrameNumber) { | 129 BeginFrameArgs::kStartingFrameNumber); |
130 DLOG(ERROR) << "Received CompositorFrame with invalid BeginFrameAck."; | 130 |
131 frame.metadata.begin_frame_ack.source_id = BeginFrameArgs::kManualSourceId; | |
132 frame.metadata.begin_frame_ack.sequence_number = | |
133 BeginFrameArgs::kStartingFrameNumber; | |
134 } | |
135 // |has_damage| is not transmitted. | 131 // |has_damage| is not transmitted. |
136 frame.metadata.begin_frame_ack.has_damage = true; | 132 frame.metadata.begin_frame_ack.has_damage = true; |
137 | 133 |
138 BeginFrameAck ack = frame.metadata.begin_frame_ack; | 134 BeginFrameAck ack = frame.metadata.begin_frame_ack; |
139 surface_factory_->SubmitCompositorFrame( | 135 surface_factory_->SubmitCompositorFrame( |
140 local_surface_id, std::move(frame), | 136 local_surface_id, std::move(frame), |
141 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, | 137 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, |
142 weak_factory_.GetWeakPtr()), | 138 weak_factory_.GetWeakPtr()), |
143 base::BindRepeating(&CompositorFrameSinkSupport::WillDrawSurface, | 139 base::BindRepeating(&CompositorFrameSinkSupport::WillDrawSurface, |
144 weak_factory_.GetWeakPtr())); | 140 weak_factory_.GetWeakPtr())); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 begin_frame_source_->RemoveObserver(this); | 270 begin_frame_source_->RemoveObserver(this); |
275 } | 271 } |
276 | 272 |
277 void CompositorFrameSinkSupport::RequestCopyOfSurface( | 273 void CompositorFrameSinkSupport::RequestCopyOfSurface( |
278 std::unique_ptr<CopyOutputRequest> request) { | 274 std::unique_ptr<CopyOutputRequest> request) { |
279 DCHECK(surface_factory_); | 275 DCHECK(surface_factory_); |
280 surface_factory_->RequestCopyOfSurface(std::move(request)); | 276 surface_factory_->RequestCopyOfSurface(std::move(request)); |
281 } | 277 } |
282 | 278 |
283 } // namespace cc | 279 } // namespace cc |
OLD | NEW |