| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 surface_factory_.EvictSurface(); | 62 surface_factory_.EvictSurface(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void CompositorFrameSinkSupport::SetNeedsBeginFrame(bool needs_begin_frame) { | 65 void CompositorFrameSinkSupport::SetNeedsBeginFrame(bool needs_begin_frame) { |
| 66 needs_begin_frame_ = needs_begin_frame; | 66 needs_begin_frame_ = needs_begin_frame; |
| 67 UpdateNeedsBeginFramesInternal(); | 67 UpdateNeedsBeginFramesInternal(); |
| 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 | |
| 73 // should not acknowledge immediately. Instead, we should update the ack that | |
| 74 // will be sent to DisplayScheduler when the pending frame is activated. | |
| 75 if (ack.sequence_number < BeginFrameArgs::kStartingFrameNumber) { | 72 if (ack.sequence_number < BeginFrameArgs::kStartingFrameNumber) { |
| 76 DLOG(ERROR) << "Received BeginFrameDidNotSwap with invalid BeginFrameAck."; | 73 DLOG(ERROR) << "Received BeginFrameDidNotSwap with invalid BeginFrameAck."; |
| 77 return; | 74 return; |
| 78 } | 75 } |
| 79 | 76 |
| 80 // |has_damage| is not transmitted, but false by default. | 77 // |has_damage| is not transmitted, but false by default. |
| 81 DCHECK(!ack.has_damage); | 78 DCHECK(!ack.has_damage); |
| 82 if (begin_frame_source_) | 79 if (begin_frame_source_) |
| 83 begin_frame_source_->DidFinishFrame(this, ack); | 80 begin_frame_source_->DidFinishFrame(this, ack); |
| 84 } | 81 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 97 } | 94 } |
| 98 // |has_damage| is not transmitted. | 95 // |has_damage| is not transmitted. |
| 99 frame.metadata.begin_frame_ack.has_damage = true; | 96 frame.metadata.begin_frame_ack.has_damage = true; |
| 100 | 97 |
| 101 BeginFrameAck ack = frame.metadata.begin_frame_ack; | 98 BeginFrameAck ack = frame.metadata.begin_frame_ack; |
| 102 surface_factory_.SubmitCompositorFrame( | 99 surface_factory_.SubmitCompositorFrame( |
| 103 local_surface_id, std::move(frame), | 100 local_surface_id, std::move(frame), |
| 104 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, | 101 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, |
| 105 weak_factory_.GetWeakPtr())); | 102 weak_factory_.GetWeakPtr())); |
| 106 | 103 |
| 107 // TODO(eseckler): The CompositorFrame submitted below might not be activated | |
| 108 // right away b/c of surface synchronization. We should only send the | |
| 109 // BeginFrameAck to DisplayScheduler when it is activated. This also means | |
| 110 // that we need to stay an active BFO while a CompositorFrame is pending. | |
| 111 // See https://crbug.com/703079. | |
| 112 if (begin_frame_source_) | 104 if (begin_frame_source_) |
| 113 begin_frame_source_->DidFinishFrame(this, ack); | 105 begin_frame_source_->DidFinishFrame(this, ack); |
| 114 } | 106 } |
| 115 | 107 |
| 116 void CompositorFrameSinkSupport::UpdateSurfaceReferences( | 108 void CompositorFrameSinkSupport::UpdateSurfaceReferences( |
| 117 const SurfaceId& last_surface_id, | 109 const SurfaceId& last_surface_id, |
| 118 const LocalSurfaceId& local_surface_id) { | 110 const LocalSurfaceId& local_surface_id) { |
| 119 const bool surface_id_changed = | 111 const bool surface_id_changed = |
| 120 last_surface_id.local_surface_id() != local_surface_id; | 112 last_surface_id.local_surface_id() != local_surface_id; |
| 121 | 113 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 else | 253 else |
| 262 begin_frame_source_->RemoveObserver(this); | 254 begin_frame_source_->RemoveObserver(this); |
| 263 } | 255 } |
| 264 | 256 |
| 265 void CompositorFrameSinkSupport::RequestCopyOfSurface( | 257 void CompositorFrameSinkSupport::RequestCopyOfSurface( |
| 266 std::unique_ptr<CopyOutputRequest> request) { | 258 std::unique_ptr<CopyOutputRequest> request) { |
| 267 surface_factory_.RequestCopyOfSurface(std::move(request)); | 259 surface_factory_.RequestCopyOfSurface(std::move(request)); |
| 268 } | 260 } |
| 269 | 261 |
| 270 } // namespace cc | 262 } // namespace cc |
| OLD | NEW |