| 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 "services/ui/public/cpp/client_compositor_frame_sink.h" | 5 #include "services/ui/public/cpp/client_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "cc/base/switches.h" | 10 #include "cc/base/switches.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void ClientCompositorFrameSink::SubmitCompositorFrame( | 74 void ClientCompositorFrameSink::SubmitCompositorFrame( |
| 75 cc::CompositorFrame frame) { | 75 cc::CompositorFrame frame) { |
| 76 DCHECK(thread_checker_); | 76 DCHECK(thread_checker_); |
| 77 DCHECK(thread_checker_->CalledOnValidThread()); | 77 DCHECK(thread_checker_->CalledOnValidThread()); |
| 78 if (!compositor_frame_sink_) | 78 if (!compositor_frame_sink_) |
| 79 return; | 79 return; |
| 80 | 80 |
| 81 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, | 81 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, |
| 82 frame.metadata.begin_frame_ack.sequence_number); | 82 frame.metadata.begin_frame_ack.sequence_number); |
| 83 | 83 |
| 84 gfx::Size frame_size = last_submitted_frame_size_; | 84 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); |
| 85 if (!frame.render_pass_list.empty()) | |
| 86 frame_size = frame.render_pass_list.back()->output_rect.size(); | |
| 87 if (!enable_surface_synchronization_ && | 85 if (!enable_surface_synchronization_ && |
| 88 (!local_surface_id_.is_valid() || | 86 (!local_surface_id_.is_valid() || |
| 89 frame_size != last_submitted_frame_size_)) { | 87 frame_size != last_submitted_frame_size_)) { |
| 90 local_surface_id_ = id_allocator_.GenerateId(); | 88 local_surface_id_ = id_allocator_.GenerateId(); |
| 91 } | 89 } |
| 92 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, | 90 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, |
| 93 std::move(frame)); | 91 std::move(frame)); |
| 94 last_submitted_frame_size_ = frame_size; | 92 last_submitted_frame_size_ = frame_size; |
| 95 } | 93 } |
| 96 | 94 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 ClientCompositorFrameSinkBinding::TakeFrameSinkRequest() { | 157 ClientCompositorFrameSinkBinding::TakeFrameSinkRequest() { |
| 160 return std::move(compositor_frame_sink_request_); | 158 return std::move(compositor_frame_sink_request_); |
| 161 } | 159 } |
| 162 | 160 |
| 163 cc::mojom::MojoCompositorFrameSinkClientPtrInfo | 161 cc::mojom::MojoCompositorFrameSinkClientPtrInfo |
| 164 ClientCompositorFrameSinkBinding::TakeFrameSinkClient() { | 162 ClientCompositorFrameSinkBinding::TakeFrameSinkClient() { |
| 165 return std::move(compositor_frame_sink_client_); | 163 return std::move(compositor_frame_sink_client_); |
| 166 } | 164 } |
| 167 | 165 |
| 168 } // namespace ui | 166 } // namespace ui |
| OLD | NEW |