| 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/browser/android/synchronous_compositor_host.h" | 5 #include "content/browser/android/synchronous_compositor_host.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 std::move(compositor_frame)); | 131 std::move(compositor_frame)); |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool SynchronousCompositorHost::DemandDrawHwReceiveFrame( | 134 bool SynchronousCompositorHost::DemandDrawHwReceiveFrame( |
| 135 const IPC::Message& message) { | 135 const IPC::Message& message) { |
| 136 SyncCompositorHostMsg_ReturnFrame::Param param; | 136 SyncCompositorHostMsg_ReturnFrame::Param param; |
| 137 if (!SyncCompositorHostMsg_ReturnFrame::Read(&message, ¶m)) | 137 if (!SyncCompositorHostMsg_ReturnFrame::Read(&message, ¶m)) |
| 138 return false; | 138 return false; |
| 139 uint32_t compositor_frame_sink_id = std::get<0>(param); | 139 uint32_t compositor_frame_sink_id = std::get<0>(param); |
| 140 cc::CompositorFrame compositor_frame = std::move(std::get<1>(param)); | 140 cc::CompositorFrame compositor_frame = std::move(std::get<1>(param)); |
| 141 client_->OnDrawHardwareProcessFrame(ProcessHardwareFrame( | 141 scoped_refptr<SynchronousCompositor::FrameFuture> frame_future = |
| 142 compositor_frame_sink_id, std::move(compositor_frame))); | 142 new FrameFuture(); |
| 143 SynchronousCompositor::Frame frame = ProcessHardwareFrame( |
| 144 compositor_frame_sink_id, std::move(compositor_frame)); |
| 145 if (!frame.frame) |
| 146 return true; |
| 147 std::unique_ptr<SynchronousCompositor::Frame> frame_ptr = |
| 148 base::MakeUnique<SynchronousCompositor::Frame>(); |
| 149 frame_ptr->frame = std::move(frame.frame); |
| 150 frame_ptr->compositor_frame_sink_id = frame.compositor_frame_sink_id; |
| 151 frame_future->setFrame(std::move(frame_ptr)); |
| 152 client_->OnDrawHardwareProcessFrameFuture(std::move(frame_future)); |
| 143 return true; | 153 return true; |
| 144 } | 154 } |
| 145 | 155 |
| 146 SynchronousCompositor::Frame SynchronousCompositorHost::ProcessHardwareFrame( | 156 SynchronousCompositor::Frame SynchronousCompositorHost::ProcessHardwareFrame( |
| 147 uint32_t compositor_frame_sink_id, | 157 uint32_t compositor_frame_sink_id, |
| 148 cc::CompositorFrame compositor_frame) { | 158 cc::CompositorFrame compositor_frame) { |
| 149 SynchronousCompositor::Frame frame; | 159 SynchronousCompositor::Frame frame; |
| 150 frame.frame.reset(new cc::CompositorFrame); | 160 frame.frame.reset(new cc::CompositorFrame); |
| 151 frame.compositor_frame_sink_id = compositor_frame_sink_id; | 161 frame.compositor_frame_sink_id = compositor_frame_sink_id; |
| 152 *frame.frame = std::move(compositor_frame); | 162 *frame.frame = std::move(compositor_frame); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 if (params.page_scale_factor) { | 425 if (params.page_scale_factor) { |
| 416 client_->UpdateRootLayerState( | 426 client_->UpdateRootLayerState( |
| 417 this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset), | 427 this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset), |
| 418 gfx::ScrollOffsetToVector2dF(params.max_scroll_offset), | 428 gfx::ScrollOffsetToVector2dF(params.max_scroll_offset), |
| 419 params.scrollable_size, params.page_scale_factor, | 429 params.scrollable_size, params.page_scale_factor, |
| 420 params.min_page_scale_factor, params.max_page_scale_factor); | 430 params.min_page_scale_factor, params.max_page_scale_factor); |
| 421 } | 431 } |
| 422 } | 432 } |
| 423 | 433 |
| 424 } // namespace content | 434 } // namespace content |
| OLD | NEW |