Index: content/browser/android/synchronous_compositor_host.cc |
diff --git a/content/browser/android/synchronous_compositor_host.cc b/content/browser/android/synchronous_compositor_host.cc |
index b0e0b9dab5a7012e3af9754467aba79c169f46ee..2a9c0820f056776919d1b8748733f8b68885da28 100644 |
--- a/content/browser/android/synchronous_compositor_host.cc |
+++ b/content/browser/android/synchronous_compositor_host.cc |
@@ -70,6 +70,8 @@ SynchronousCompositorHost::SynchronousCompositorHost( |
routing_id_(rwhva_->GetRenderWidgetHost()->GetRoutingID()), |
sender_(rwhva_->GetRenderWidgetHost()), |
use_in_process_zero_copy_software_draw_(use_in_proc_software_draw), |
+ // did_receive_first_frame_synchronously_(false), |
+ sync_call_count_(0u), |
bytes_limit_(0u), |
renderer_param_version_(0u), |
need_animate_scroll_(false), |
@@ -88,12 +90,13 @@ bool SynchronousCompositorHost::OnMessageReceived(const IPC::Message& message) { |
IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_OutputSurfaceCreated, |
OutputSurfaceCreated) |
IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_UpdateState, ProcessCommonParams) |
+ IPC_MESSAGE_HANDLER(CompositorHostMsg_Frame, DemandDrawHwReceiveFrame) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
return handled; |
} |
-SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw( |
+SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw_Sync( |
const gfx::Size& surface_size, |
const gfx::Transform& transform, |
const gfx::Rect& viewport, |
@@ -122,6 +125,66 @@ SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw( |
return frame; |
} |
+SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw( |
+ const gfx::Size& surface_size, |
+ const gfx::Transform& transform, |
+ const gfx::Rect& viewport, |
+ const gfx::Rect& clip, |
+ const gfx::Rect& viewport_rect_for_tile_priority, |
+ const gfx::Transform& transform_for_tile_priority) { |
+ // if (!did_receive_first_frame_synchronously_) |
+ if (sync_call_count_++ < 60) { |
+ // did_receive_first_frame_synchronously_ = true; |
+ return DemandDrawHw_Sync(surface_size, transform, viewport, clip, |
+ viewport_rect_for_tile_priority, |
+ transform_for_tile_priority); |
+ } |
+ |
+ SyncCompositorDemandDrawHwParams params(surface_size, transform, viewport, |
+ clip, viewport_rect_for_tile_priority, |
+ transform_for_tile_priority); |
+ SynchronousCompositor::Frame frame; |
+ frame.frame.reset(new cc::CompositorFrame); |
boliu
2016/07/29 00:48:21
you are creating a CompositorFrame here that's emp
|
+ // SyncCompositorCommonRendererParams common_renderer_params; |
+ |
+ /* Send an async message instead of a synchronous one. |
+ * Currently not sure what to do in the analogous case |
+ * when sending sync message returns false. */ |
+ // if (!sender_->Send(new SyncCompositorMsg_DemandDrawHw( |
+ // routing_id_, params, &common_renderer_params, |
+ // &frame.output_surface_id, frame.frame.get()))) { |
+ // return SynchronousCompositor::Frame(); |
+ // } |
+ |
+ sender_->Send(new CompositorMsg_DemandDrawHw(routing_id_, params)); |
+ |
+ return frame; |
+} |
+ |
+void SynchronousCompositorHost::DemandDrawHwReceiveFrame( |
+ uint32_t output_surface_id, |
+ const cc::CompositorFrame& compositor_frame) { |
+ // ProcessCommonParams(common_renderer_params); |
+ SynchronousCompositor::Frame frame; |
+ frame.frame.reset(new cc::CompositorFrame); |
+ frame.output_surface_id = output_surface_id; |
+ // *frame.frame.get() = compositor_frame; |
+ // frame = compositor_frame; |
+ // frame.frame.reset(&compositor_frame); |
+ *frame.frame = std::move(const_cast<cc::CompositorFrame&>(compositor_frame)); |
+ frame.output_surface_id = output_surface_id; |
+ |
+ if (!frame.frame->delegated_frame_data) { |
+ // This can happen if compositor did not swap in this draw. |
+ frame.frame.reset(); |
+ } |
+ if (frame.frame) { |
+ UpdateFrameMetaData(frame.frame->metadata.Clone()); |
+ } |
+ // return frame; |
+ client_->OnDrawHardwareProcessFrame(std::move(frame)); |
+} |
+ |
void SynchronousCompositorHost::UpdateFrameMetaData( |
cc::CompositorFrameMetadata frame_metadata) { |
rwhva_->SynchronousFrameMetadata(std::move(frame_metadata)); |