| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 void CompositorFrameSinkSupport::BeginFrameDidNotSwap( | 70 void CompositorFrameSinkSupport::BeginFrameDidNotSwap( |
| 71 const BeginFrameAck& ack) { | 71 const BeginFrameAck& ack) { |
| 72 // TODO(eseckler): While a pending CompositorFrame exists (see TODO below), we | 72 // TODO(eseckler): While a pending CompositorFrame exists (see TODO below), we |
| 73 // should not acknowledge immediately. Instead, we should update the ack that | 73 // should not acknowledge immediately. Instead, we should update the ack that |
| 74 // will be sent to DisplayScheduler when the pending frame is activated. | 74 // will be sent to DisplayScheduler when the pending frame is activated. |
| 75 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); | 75 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); |
| 76 // |has_damage| is not transmitted, but false by default. | 76 // |has_damage| is not transmitted, but false by default. |
| 77 DCHECK(!ack.has_damage); | 77 DCHECK(!ack.has_damage); |
| 78 // |remaining_frames| is not transmitted, but 0 by default. | |
| 79 DCHECK_EQ(0u, ack.remaining_frames); | |
| 80 if (begin_frame_source_) | 78 if (begin_frame_source_) |
| 81 begin_frame_source_->DidFinishFrame(this, ack); | 79 begin_frame_source_->DidFinishFrame(this, ack); |
| 82 } | 80 } |
| 83 | 81 |
| 84 void CompositorFrameSinkSupport::SubmitCompositorFrame( | 82 void CompositorFrameSinkSupport::SubmitCompositorFrame( |
| 85 const LocalSurfaceId& local_surface_id, | 83 const LocalSurfaceId& local_surface_id, |
| 86 CompositorFrame frame) { | 84 CompositorFrame frame) { |
| 87 ++ack_pending_count_; | 85 ++ack_pending_count_; |
| 88 | 86 |
| 89 if (frame.metadata.begin_frame_ack.sequence_number < | 87 if (frame.metadata.begin_frame_ack.sequence_number < |
| 90 BeginFrameArgs::kStartingFrameNumber) { | 88 BeginFrameArgs::kStartingFrameNumber) { |
| 91 DLOG(ERROR) << "Received CompositorFrame with invalid BeginFrameAck."; | 89 DLOG(ERROR) << "Received CompositorFrame with invalid BeginFrameAck."; |
| 92 frame.metadata.begin_frame_ack.source_id = BeginFrameArgs::kManualSourceId; | 90 frame.metadata.begin_frame_ack.source_id = BeginFrameArgs::kManualSourceId; |
| 93 frame.metadata.begin_frame_ack.sequence_number = | 91 frame.metadata.begin_frame_ack.sequence_number = |
| 94 BeginFrameArgs::kStartingFrameNumber; | 92 BeginFrameArgs::kStartingFrameNumber; |
| 95 } | 93 } |
| 96 // |has_damage| and |remaining_frames| are not transmitted. | 94 // |has_damage| is not transmitted. |
| 97 frame.metadata.begin_frame_ack.has_damage = true; | 95 frame.metadata.begin_frame_ack.has_damage = true; |
| 98 frame.metadata.begin_frame_ack.remaining_frames = 0; | |
| 99 | 96 |
| 100 surface_factory_.SubmitCompositorFrame( | 97 surface_factory_.SubmitCompositorFrame( |
| 101 local_surface_id, std::move(frame), | 98 local_surface_id, std::move(frame), |
| 102 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, | 99 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, |
| 103 weak_factory_.GetWeakPtr())); | 100 weak_factory_.GetWeakPtr())); |
| 104 | 101 |
| 105 // TODO(eseckler): The CompositorFrame submitted below might not be activated | 102 // TODO(eseckler): The CompositorFrame submitted below might not be activated |
| 106 // right away b/c of surface synchronization. We should only send the | 103 // right away b/c of surface synchronization. We should only send the |
| 107 // BeginFrameAck to DisplayScheduler when it is activated. This also means | 104 // BeginFrameAck to DisplayScheduler when it is activated. This also means |
| 108 // that we need to stay an active BFO while a CompositorFrame is pending. | 105 // that we need to stay an active BFO while a CompositorFrame is pending. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 else | 256 else |
| 260 begin_frame_source_->RemoveObserver(this); | 257 begin_frame_source_->RemoveObserver(this); |
| 261 } | 258 } |
| 262 | 259 |
| 263 void CompositorFrameSinkSupport::RequestCopyOfSurface( | 260 void CompositorFrameSinkSupport::RequestCopyOfSurface( |
| 264 std::unique_ptr<CopyOutputRequest> request) { | 261 std::unique_ptr<CopyOutputRequest> request) { |
| 265 surface_factory_.RequestCopyOfSurface(std::move(request)); | 262 surface_factory_.RequestCopyOfSurface(std::move(request)); |
| 266 } | 263 } |
| 267 | 264 |
| 268 } // namespace cc | 265 } // namespace cc |
| OLD | NEW |