| Index: content/renderer/android/synchronous_compositor_proxy.cc
|
| diff --git a/content/renderer/android/synchronous_compositor_proxy.cc b/content/renderer/android/synchronous_compositor_proxy.cc
|
| index 6b9883b5a21ed3f138cd8262698a8cc667603b2c..4c533b6ec936add898a86d2dff1fe0f12c0fac82 100644
|
| --- a/content/renderer/android/synchronous_compositor_proxy.cc
|
| +++ b/content/renderer/android/synchronous_compositor_proxy.cc
|
| @@ -35,6 +35,7 @@ SynchronousCompositorProxy::SynchronousCompositorProxy(
|
| inside_receive_(false),
|
| hardware_draw_reply_(nullptr),
|
| software_draw_reply_(nullptr),
|
| + hardware_draw_reply_async_(false),
|
| version_(0u),
|
| page_scale_factor_(0.f),
|
| min_page_scale_factor_(0.f),
|
| @@ -136,7 +137,9 @@ void SynchronousCompositorProxy::OnMessageReceived(
|
| PopulateCommonParams)
|
| IPC_MESSAGE_HANDLER(SyncCompositorMsg_ComputeScroll, OnComputeScroll)
|
| IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawHw,
|
| - DemandDrawHw)
|
| + DemandDrawHw_Sync)
|
| + IPC_MESSAGE_HANDLER(CompositorMsg_DemandDrawHw, DemandDrawHw)
|
| +
|
| IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetSharedMemory, SetSharedMemory)
|
| IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZeroSharedMemory, ZeroSharedMemory)
|
| IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawSw,
|
| @@ -150,7 +153,7 @@ bool SynchronousCompositorProxy::Send(IPC::Message* message) {
|
| return sender_->Send(message);
|
| }
|
|
|
| -void SynchronousCompositorProxy::DemandDrawHw(
|
| +void SynchronousCompositorProxy::DemandDrawHw_Sync(
|
| const SyncCompositorDemandDrawHwParams& params,
|
| IPC::Message* reply_message) {
|
| DCHECK(!inside_receive_);
|
| @@ -169,21 +172,63 @@ void SynchronousCompositorProxy::DemandDrawHw(
|
|
|
| if (inside_receive_) {
|
| // Did not swap.
|
| - SendDemandDrawHwReply(cc::CompositorFrame(), 0u, reply_message);
|
| + SendDemandDrawHwReply_Sync(cc::CompositorFrame(), 0u, reply_message);
|
| inside_receive_ = false;
|
| }
|
| }
|
|
|
| +void SynchronousCompositorProxy::DemandDrawHw(
|
| + // const SyncCompositorDemandDrawHwParams& params,
|
| + // IPC::Message* reply_message) {
|
| + const SyncCompositorDemandDrawHwParams& params) {
|
| + DCHECK(!inside_receive_);
|
| + // DCHECK(reply_message);
|
| +
|
| + inside_receive_ = true;
|
| +
|
| + if (output_surface_) {
|
| + /* TODO: Since there is no reply message, is it OK to just set
|
| + * hardware_draw_reply_ to anything that passes the DCHECK for being true?
|
| + */
|
| + // base::AutoReset<IPC::Message*> scoped_hardware_draw_reply(
|
| + // &hardware_draw_reply_, reply_message);
|
| + base::AutoReset<bool> scoped_hardware_draw_reply_async(
|
| + &hardware_draw_reply_async_, true);
|
| + hardware_draw_reply_ = new IPC::Message();
|
| + output_surface_->DemandDrawHw(params.surface_size, params.transform,
|
| + params.viewport, params.clip,
|
| + params.viewport_rect_for_tile_priority,
|
| + params.transform_for_tile_priority);
|
| + }
|
| +
|
| + if (inside_receive_) {
|
| + // Did not swap.
|
| + // SendDemandDrawHwReply(cc::CompositorFrame(), 0u, reply_message);
|
| + SendDemandDrawHwReply(cc::CompositorFrame(), 0u);
|
| + inside_receive_ = false;
|
| + }
|
| +}
|
| +
|
| +void SynchronousCompositorProxy::SwapBuffersHw_Sync(uint32_t output_surface_id,
|
| + cc::CompositorFrame frame) {
|
| + DCHECK(inside_receive_);
|
| + DCHECK(hardware_draw_reply_);
|
| + SendDemandDrawHwReply_Sync(std::move(frame), output_surface_id,
|
| + hardware_draw_reply_);
|
| + inside_receive_ = false;
|
| +}
|
| +
|
| void SynchronousCompositorProxy::SwapBuffersHw(uint32_t output_surface_id,
|
| cc::CompositorFrame frame) {
|
| DCHECK(inside_receive_);
|
| - DCHECK(hardware_draw_reply_);
|
| - SendDemandDrawHwReply(std::move(frame), output_surface_id,
|
| - hardware_draw_reply_);
|
| + DCHECK(hardware_draw_reply_async_);
|
| + // SendDemandDrawHwReply(std::move(frame), output_surface_id,
|
| + // hardware_draw_reply_);
|
| + SendDemandDrawHwReply(std::move(frame), output_surface_id);
|
| inside_receive_ = false;
|
| }
|
|
|
| -void SynchronousCompositorProxy::SendDemandDrawHwReply(
|
| +void SynchronousCompositorProxy::SendDemandDrawHwReply_Sync(
|
| cc::CompositorFrame frame,
|
| uint32_t output_surface_id,
|
| IPC::Message* reply_message) {
|
| @@ -194,6 +239,18 @@ void SynchronousCompositorProxy::SendDemandDrawHwReply(
|
| Send(reply_message);
|
| }
|
|
|
| +void SynchronousCompositorProxy::SendDemandDrawHwReply(
|
| + cc::CompositorFrame frame,
|
| + uint32_t output_surface_id) {
|
| + // uint32_t output_surface_id,
|
| + // IPC::Message* reply_message) {
|
| + //
|
| + // SyncCompositorMsg_DemandDrawHw::WriteReplyParams(
|
| + // reply_message, common_renderer_params, output_surface_id, frame);
|
| + // Send(reply_message);
|
| + Send(new CompositorHostMsg_Frame(routing_id_, output_surface_id, frame));
|
| +}
|
| +
|
| struct SynchronousCompositorProxy::SharedMemoryWithSize {
|
| base::SharedMemory shm;
|
| const size_t buffer_size;
|
| @@ -300,10 +357,13 @@ void SynchronousCompositorProxy::SendDemandDrawSwReply(
|
|
|
| void SynchronousCompositorProxy::SwapBuffers(uint32_t output_surface_id,
|
| cc::CompositorFrame frame) {
|
| - DCHECK(hardware_draw_reply_ || software_draw_reply_);
|
| + DCHECK(hardware_draw_reply_async_ || hardware_draw_reply_ ||
|
| + software_draw_reply_);
|
| DCHECK(!(hardware_draw_reply_ && software_draw_reply_));
|
| - if (hardware_draw_reply_) {
|
| + if (hardware_draw_reply_async_) {
|
| SwapBuffersHw(output_surface_id, std::move(frame));
|
| + } else if (hardware_draw_reply_) {
|
| + SwapBuffersHw_Sync(output_surface_id, std::move(frame));
|
| } else if (software_draw_reply_) {
|
| SwapBuffersSw(std::move(frame));
|
| }
|
|
|