| 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 #include "cc/surfaces/direct_compositor_frame_sink.h" | 5 #include "cc/surfaces/direct_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/compositor_frame_sink_client.h" | 9 #include "cc/output/compositor_frame_sink_client.h" |
| 10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 begin_frame_source_.reset(); | 87 begin_frame_source_.reset(); |
| 88 | 88 |
| 89 // Unregister the SurfaceFactoryClient here instead of the dtor so that only | 89 // Unregister the SurfaceFactoryClient here instead of the dtor so that only |
| 90 // one client is alive for this namespace at any given time. | 90 // one client is alive for this namespace at any given time. |
| 91 support_.reset(); | 91 support_.reset(); |
| 92 | 92 |
| 93 CompositorFrameSink::DetachFromClient(); | 93 CompositorFrameSink::DetachFromClient(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { | 96 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { |
| 97 DCHECK(frame.metadata.begin_frame_ack.has_damage); |
| 98 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, |
| 99 frame.metadata.begin_frame_ack.sequence_number); |
| 100 |
| 97 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); | 101 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); |
| 98 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { | 102 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { |
| 99 delegated_local_surface_id_ = local_surface_id_allocator_.GenerateId(); | 103 delegated_local_surface_id_ = local_surface_id_allocator_.GenerateId(); |
| 100 last_swap_frame_size_ = frame_size; | 104 last_swap_frame_size_ = frame_size; |
| 101 } | 105 } |
| 102 display_->SetLocalSurfaceId(delegated_local_surface_id_, | 106 display_->SetLocalSurfaceId(delegated_local_surface_id_, |
| 103 frame.metadata.device_scale_factor); | 107 frame.metadata.device_scale_factor); |
| 104 | 108 |
| 105 support_->SubmitCompositorFrame(delegated_local_surface_id_, | 109 support_->SubmitCompositorFrame(delegated_local_surface_id_, |
| 106 std::move(frame)); | 110 std::move(frame)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const LocalSurfaceId& local_surface_id, | 148 const LocalSurfaceId& local_surface_id, |
| 145 const gfx::Rect& damage_rect) { | 149 const gfx::Rect& damage_rect) { |
| 146 // TODO(staraz): Implement this. | 150 // TODO(staraz): Implement this. |
| 147 } | 151 } |
| 148 | 152 |
| 149 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) { | 153 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) { |
| 150 support_->SetNeedsBeginFrame(needs_begin_frame); | 154 support_->SetNeedsBeginFrame(needs_begin_frame); |
| 151 } | 155 } |
| 152 | 156 |
| 153 void DirectCompositorFrameSink::OnDidFinishFrame(const BeginFrameAck& ack) { | 157 void DirectCompositorFrameSink::OnDidFinishFrame(const BeginFrameAck& ack) { |
| 154 support_->DidFinishFrame(ack); | 158 // If there was damage, SubmitCompositorFrame includes the ack. |
| 159 if (!ack.has_damage) |
| 160 support_->BeginFrameDidNotSwap(ack); |
| 155 } | 161 } |
| 156 | 162 |
| 157 } // namespace cc | 163 } // namespace cc |
| OLD | NEW |