| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/ui/ws/display_client_compositor_frame_sink.h" | 5 #include "services/ui/ws/display_client_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/threading/thread_checker.h" | 7 #include "base/threading/thread_checker.h" |
| 8 #include "cc/output/compositor_frame_sink_client.h" | 8 #include "cc/output/compositor_frame_sink_client.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 void DisplayClientCompositorFrameSink::SubmitCompositorFrame( | 45 void DisplayClientCompositorFrameSink::SubmitCompositorFrame( |
| 46 cc::CompositorFrame frame) { | 46 cc::CompositorFrame frame) { |
| 47 DCHECK(thread_checker_->CalledOnValidThread()); | 47 DCHECK(thread_checker_->CalledOnValidThread()); |
| 48 if (!compositor_frame_sink_) | 48 if (!compositor_frame_sink_) |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, | 51 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, |
| 52 frame.metadata.begin_frame_ack.sequence_number); | 52 frame.metadata.begin_frame_ack.sequence_number); |
| 53 | 53 |
| 54 gfx::Size frame_size = last_submitted_frame_size_; | 54 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); |
| 55 if (!frame.render_pass_list.empty()) | |
| 56 frame_size = frame.render_pass_list.back()->output_rect.size(); | |
| 57 | 55 |
| 58 if (!local_surface_id_.is_valid() || | 56 if (!local_surface_id_.is_valid() || |
| 59 frame_size != last_submitted_frame_size_) { | 57 frame_size != last_submitted_frame_size_) { |
| 60 local_surface_id_ = id_allocator_.GenerateId(); | 58 local_surface_id_ = id_allocator_.GenerateId(); |
| 61 display_private_->ResizeDisplay(frame_size); | 59 display_private_->ResizeDisplay(frame_size); |
| 62 } | 60 } |
| 63 display_private_->SetLocalSurfaceId(local_surface_id_, | 61 display_private_->SetLocalSurfaceId(local_surface_id_, |
| 64 frame.metadata.device_scale_factor); | 62 frame.metadata.device_scale_factor); |
| 65 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, | 63 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, |
| 66 std::move(frame)); | 64 std::move(frame)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 96 |
| 99 void DisplayClientCompositorFrameSink::OnDidFinishFrame( | 97 void DisplayClientCompositorFrameSink::OnDidFinishFrame( |
| 100 const cc::BeginFrameAck& ack) { | 98 const cc::BeginFrameAck& ack) { |
| 101 // If there was damage, the submitted CompositorFrame includes the ack. | 99 // If there was damage, the submitted CompositorFrame includes the ack. |
| 102 if (!ack.has_damage) | 100 if (!ack.has_damage) |
| 103 compositor_frame_sink_->BeginFrameDidNotSwap(ack); | 101 compositor_frame_sink_->BeginFrameDidNotSwap(ack); |
| 104 } | 102 } |
| 105 | 103 |
| 106 } // namespace ws | 104 } // namespace ws |
| 107 } // namespace ui | 105 } // namespace ui |
| OLD | NEW |