Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1965)

Unified Diff: content/renderer/android/synchronous_compositor_proxy.cc

Issue 2174203002: OnDrawHardware() implementation with async messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added flag to branch old and new implementation Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 1c40c25f255efbeb3004d12f769343265c151468..d4301b5dfb5c47951809cd0e21698b66545f791f 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),
@@ -135,6 +136,7 @@ void SynchronousCompositorProxy::OnMessageReceived(
IPC_MESSAGE_HANDLER(SyncCompositorMsg_ComputeScroll, OnComputeScroll)
IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawHw,
DemandDrawHw)
+ IPC_MESSAGE_HANDLER(CompositorMsg_DemandDrawHw, DemandDrawHw_Async)
IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetSharedMemory, SetSharedMemory)
IPC_MESSAGE_HANDLER(SyncCompositorMsg_ZeroSharedMemory, ZeroSharedMemory)
IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncCompositorMsg_DemandDrawSw,
@@ -148,6 +150,34 @@ bool SynchronousCompositorProxy::Send(IPC::Message* message) {
return sender_->Send(message);
}
+void SynchronousCompositorProxy::DemandDrawHw_Async(
boliu 2016/08/11 19:23:40 this is mostly identical to DemandDrawHw so should
ojars 2016/08/23 02:15:42 Done.
+ const SyncCompositorDemandDrawHwParams& params) {
+ // const SyncCompositorDemandDrawHwParams& params,
+ // IPC::Message* reply_message) {
+ DCHECK(!inside_receive_);
+ inside_receive_ = true;
+
+ // SyncCompositorCommonRendererParams common_renderer_params;
+ // PopulateCommonParams(&common_renderer_params);
+ // CompositorMsg_DemandDrawHw::WriteReplyParams(
+ // reply_message, common_renderer_params);
+ // Send(reply_message);
+
+ if (output_surface_) {
+ base::AutoReset<bool> scoped_hardware_draw_reply_async(
+ &hardware_draw_reply_async_, true);
+ output_surface_->DemandDrawHw(params.viewport_size,
+ params.viewport_rect_for_tile_priority,
+ params.transform_for_tile_priority);
+ }
+
+ if (inside_receive_) {
+ // Did not swap.
+ SendDemandDrawHwReply_Async(cc::CompositorFrame(), 0u);
+ inside_receive_ = false;
+ }
+}
+
void SynchronousCompositorProxy::DemandDrawHw(
const SyncCompositorDemandDrawHwParams& params,
IPC::Message* reply_message) {
@@ -171,6 +201,15 @@ void SynchronousCompositorProxy::DemandDrawHw(
}
}
+void SynchronousCompositorProxy::SwapBuffersHw_Async(
+ uint32_t output_surface_id,
+ cc::CompositorFrame frame) {
+ DCHECK(inside_receive_);
+ DCHECK(hardware_draw_reply_async_);
+ SendDemandDrawHwReply_Async(std::move(frame), output_surface_id);
+ inside_receive_ = false;
+}
+
void SynchronousCompositorProxy::SwapBuffersHw(uint32_t output_surface_id,
cc::CompositorFrame frame) {
DCHECK(inside_receive_);
@@ -180,6 +219,12 @@ void SynchronousCompositorProxy::SwapBuffersHw(uint32_t output_surface_id,
inside_receive_ = false;
}
+void SynchronousCompositorProxy::SendDemandDrawHwReply_Async(
+ cc::CompositorFrame frame,
+ uint32_t output_surface_id) {
+ Send(new CompositorHostMsg_Frame(routing_id_, output_surface_id, frame));
+}
+
void SynchronousCompositorProxy::SendDemandDrawHwReply(
cc::CompositorFrame frame,
uint32_t output_surface_id,
@@ -297,9 +342,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_ && software_draw_reply_));
- if (hardware_draw_reply_) {
+ DCHECK(hardware_draw_reply_async_ || hardware_draw_reply_ ||
+ software_draw_reply_);
+ DCHECK(!((hardware_draw_reply_ || hardware_draw_reply_async_) &&
+ software_draw_reply_));
boliu 2016/08/11 19:23:40 the DCHECKs were for exactly one of these things b
ojars 2016/08/23 02:15:42 Done.
+ if (hardware_draw_reply_async_) {
+ SwapBuffersHw_Async(output_surface_id, std::move(frame));
+ } else if (hardware_draw_reply_) {
SwapBuffersHw(output_surface_id, std::move(frame));
} else if (software_draw_reply_) {
SwapBuffersSw(std::move(frame));

Powered by Google App Engine
This is Rietveld 408576698