Chromium Code Reviews| 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::Optional<cc::CompositorFrame>(), 0u); |
|
boliu
2016/10/27 19:52:16
would nullptr work here?
| |
| 192 } else { | 192 } else { |
| 193 SendDemandDrawHwReply(cc::CompositorFrame(), 0u, reply_message); | 193 SendDemandDrawHwReply(base::Optional<cc::CompositorFrame>(), 0u, |
| 194 reply_message); | |
| 194 } | 195 } |
| 195 inside_receive_ = false; | 196 inside_receive_ = false; |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 | 199 |
| 199 void SynchronousCompositorProxy::SubmitCompositorFrameHwAsync( | 200 void SynchronousCompositorProxy::SubmitCompositorFrameHwAsync( |
| 200 uint32_t compositor_frame_sink_id, | 201 uint32_t compositor_frame_sink_id, |
| 201 cc::CompositorFrame frame) { | 202 cc::CompositorFrame frame) { |
| 202 DCHECK(inside_receive_); | 203 DCHECK(inside_receive_); |
| 203 DCHECK(hardware_draw_reply_async_); | 204 DCHECK(hardware_draw_reply_async_); |
| 204 SendDemandDrawHwReplyAsync(std::move(frame), compositor_frame_sink_id); | 205 SendDemandDrawHwReplyAsync(std::move(frame), compositor_frame_sink_id); |
| 205 inside_receive_ = false; | 206 inside_receive_ = false; |
| 206 } | 207 } |
| 207 | 208 |
| 208 void SynchronousCompositorProxy::SubmitCompositorFrameHw( | 209 void SynchronousCompositorProxy::SubmitCompositorFrameHw( |
| 209 uint32_t compositor_frame_sink_id, | 210 uint32_t compositor_frame_sink_id, |
| 210 cc::CompositorFrame frame) { | 211 cc::CompositorFrame frame) { |
| 211 DCHECK(inside_receive_); | 212 DCHECK(inside_receive_); |
| 212 DCHECK(hardware_draw_reply_); | 213 DCHECK(hardware_draw_reply_); |
| 213 SendDemandDrawHwReply(std::move(frame), compositor_frame_sink_id, | 214 SendDemandDrawHwReply(std::move(frame), compositor_frame_sink_id, |
| 214 hardware_draw_reply_); | 215 hardware_draw_reply_); |
| 215 inside_receive_ = false; | 216 inside_receive_ = false; |
| 216 } | 217 } |
| 217 | 218 |
| 218 void SynchronousCompositorProxy::SendDemandDrawHwReplyAsync( | 219 void SynchronousCompositorProxy::SendDemandDrawHwReplyAsync( |
| 219 cc::CompositorFrame frame, | 220 base::Optional<cc::CompositorFrame> frame, |
| 220 uint32_t compositor_frame_sink_id) { | 221 uint32_t compositor_frame_sink_id) { |
| 221 Send(new SyncCompositorHostMsg_ReturnFrame(routing_id_, | 222 Send(new SyncCompositorHostMsg_ReturnFrame(routing_id_, |
| 222 compositor_frame_sink_id, frame)); | 223 compositor_frame_sink_id, frame)); |
| 223 } | 224 } |
| 224 | 225 |
| 225 void SynchronousCompositorProxy::SendDemandDrawHwReply( | 226 void SynchronousCompositorProxy::SendDemandDrawHwReply( |
| 226 cc::CompositorFrame frame, | 227 base::Optional<cc::CompositorFrame> frame, |
| 227 uint32_t compositor_frame_sink_id, | 228 uint32_t compositor_frame_sink_id, |
| 228 IPC::Message* reply_message) { | 229 IPC::Message* reply_message) { |
| 229 SyncCompositorCommonRendererParams common_renderer_params; | 230 SyncCompositorCommonRendererParams common_renderer_params; |
| 230 PopulateCommonParams(&common_renderer_params); | 231 PopulateCommonParams(&common_renderer_params); |
| 231 SyncCompositorMsg_DemandDrawHw::WriteReplyParams( | 232 SyncCompositorMsg_DemandDrawHw::WriteReplyParams( |
| 232 reply_message, common_renderer_params, compositor_frame_sink_id, frame); | 233 reply_message, common_renderer_params, compositor_frame_sink_id, frame); |
| 233 Send(reply_message); | 234 Send(reply_message); |
| 234 } | 235 } |
| 235 | 236 |
| 236 struct SynchronousCompositorProxy::SharedMemoryWithSize { | 237 struct SynchronousCompositorProxy::SharedMemoryWithSize { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 | 377 |
| 377 void SynchronousCompositorProxy::SetScroll( | 378 void SynchronousCompositorProxy::SetScroll( |
| 378 const gfx::ScrollOffset& new_total_scroll_offset) { | 379 const gfx::ScrollOffset& new_total_scroll_offset) { |
| 379 if (total_scroll_offset_ == new_total_scroll_offset) | 380 if (total_scroll_offset_ == new_total_scroll_offset) |
| 380 return; | 381 return; |
| 381 total_scroll_offset_ = new_total_scroll_offset; | 382 total_scroll_offset_ = new_total_scroll_offset; |
| 382 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_); | 383 input_handler_proxy_->SynchronouslySetRootScrollOffset(total_scroll_offset_); |
| 383 } | 384 } |
| 384 | 385 |
| 385 } // namespace content | 386 } // namespace content |
| OLD | NEW |