| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/android/synchronous_compositor_proxy.h" | 5 #include "content/renderer/android/synchronous_compositor_proxy.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "cc/ipc/cc_param_traits.h" | 10 #include "cc/ipc/cc_param_traits.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 &hardware_draw_reply_, reply_message); | 181 &hardware_draw_reply_, reply_message); |
| 182 compositor_frame_sink_->DemandDrawHw( | 182 compositor_frame_sink_->DemandDrawHw( |
| 183 params.viewport_size, params.viewport_rect_for_tile_priority, | 183 params.viewport_size, params.viewport_rect_for_tile_priority, |
| 184 params.transform_for_tile_priority); | 184 params.transform_for_tile_priority); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 if (inside_receive_) { | 188 if (inside_receive_) { |
| 189 // Did not swap. | 189 // Did not swap. |
| 190 if (!reply_message) { | 190 if (!reply_message) { |
| 191 SendDemandDrawHwReplyAsync(cc::CompositorFrame(), 0u); | 191 SendDemandDrawHwReplyAsync(base::nullopt, 0u); |
| 192 } else { | 192 } else { |
| 193 SendDemandDrawHwReply(cc::CompositorFrame(), 0u, reply_message); | 193 SendDemandDrawHwReply(base::nullopt, 0u, reply_message); |
| 194 } | 194 } |
| 195 inside_receive_ = false; | 195 inside_receive_ = false; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 void SynchronousCompositorProxy::SubmitCompositorFrameHwAsync( | 199 void SynchronousCompositorProxy::SubmitCompositorFrameHwAsync( |
| 200 uint32_t compositor_frame_sink_id, | 200 uint32_t compositor_frame_sink_id, |
| 201 cc::CompositorFrame frame) { | 201 cc::CompositorFrame frame) { |
| 202 DCHECK(inside_receive_); | 202 DCHECK(inside_receive_); |
| 203 DCHECK(hardware_draw_reply_async_); | 203 DCHECK(hardware_draw_reply_async_); |
| 204 SendDemandDrawHwReplyAsync(std::move(frame), compositor_frame_sink_id); | 204 SendDemandDrawHwReplyAsync(std::move(frame), compositor_frame_sink_id); |
| 205 inside_receive_ = false; | 205 inside_receive_ = false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 void SynchronousCompositorProxy::SubmitCompositorFrameHw( | 208 void SynchronousCompositorProxy::SubmitCompositorFrameHw( |
| 209 uint32_t compositor_frame_sink_id, | 209 uint32_t compositor_frame_sink_id, |
| 210 cc::CompositorFrame frame) { | 210 cc::CompositorFrame frame) { |
| 211 DCHECK(inside_receive_); | 211 DCHECK(inside_receive_); |
| 212 DCHECK(hardware_draw_reply_); | 212 DCHECK(hardware_draw_reply_); |
| 213 SendDemandDrawHwReply(std::move(frame), compositor_frame_sink_id, | 213 SendDemandDrawHwReply(std::move(frame), compositor_frame_sink_id, |
| 214 hardware_draw_reply_); | 214 hardware_draw_reply_); |
| 215 inside_receive_ = false; | 215 inside_receive_ = false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void SynchronousCompositorProxy::SendDemandDrawHwReplyAsync( | 218 void SynchronousCompositorProxy::SendDemandDrawHwReplyAsync( |
| 219 cc::CompositorFrame frame, | 219 base::Optional<cc::CompositorFrame> frame, |
| 220 uint32_t compositor_frame_sink_id) { | 220 uint32_t compositor_frame_sink_id) { |
| 221 Send(new SyncCompositorHostMsg_ReturnFrame(routing_id_, | 221 Send(new SyncCompositorHostMsg_ReturnFrame(routing_id_, |
| 222 compositor_frame_sink_id, frame)); | 222 compositor_frame_sink_id, frame)); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void SynchronousCompositorProxy::SendDemandDrawHwReply( | 225 void SynchronousCompositorProxy::SendDemandDrawHwReply( |
| 226 cc::CompositorFrame frame, | 226 base::Optional<cc::CompositorFrame> frame, |
| 227 uint32_t compositor_frame_sink_id, | 227 uint32_t compositor_frame_sink_id, |
| 228 IPC::Message* reply_message) { | 228 IPC::Message* reply_message) { |
| 229 SyncCompositorCommonRendererParams common_renderer_params; | 229 SyncCompositorCommonRendererParams common_renderer_params; |
| 230 PopulateCommonParams(&common_renderer_params); | 230 PopulateCommonParams(&common_renderer_params); |
| 231 SyncCompositorMsg_DemandDrawHw::WriteReplyParams( | 231 SyncCompositorMsg_DemandDrawHw::WriteReplyParams( |
| 232 reply_message, common_renderer_params, compositor_frame_sink_id, frame); | 232 reply_message, common_renderer_params, compositor_frame_sink_id, frame); |
| 233 Send(reply_message); | 233 Send(reply_message); |
| 234 } | 234 } |
| 235 | 235 |
| 236 struct SynchronousCompositorProxy::SharedMemoryWithSize { | 236 struct SynchronousCompositorProxy::SharedMemoryWithSize { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 void SynchronousCompositorProxy::SetScroll( | 377 void SynchronousCompositorProxy::SetScroll( |
| 378 const gfx::ScrollOffset& new_total_scroll_offset) { | 378 const gfx::ScrollOffset& new_total_scroll_offset) { |
| 379 if (total_scroll_offset_ == new_total_scroll_offset) | 379 if (total_scroll_offset_ == new_total_scroll_offset) |
| 380 return; | 380 return; |
| 381 total_scroll_offset_ = new_total_scroll_offset; | 381 total_scroll_offset_ = new_total_scroll_offset; |
| 382 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_); | 382 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace content | 385 } // namespace content |
| OLD | NEW |