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

Unified Diff: content/browser/android/synchronous_compositor_host.cc

Issue 2174203002: OnDrawHardware() implementation with async messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/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..e8fecd035a62ac56742afa6f4f070c233cacbe35 100644
--- a/content/browser/android/synchronous_compositor_host.cc
+++ b/content/browser/android/synchronous_compositor_host.cc
@@ -88,6 +88,7 @@ bool SynchronousCompositorHost::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_OutputSurfaceCreated,
OutputSurfaceCreated)
IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_UpdateState, ProcessCommonParams)
+ IPC_MESSAGE_HANDLER(CompositorHostMsg_Frame, ReceiveFrame)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -106,20 +107,46 @@ SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw(
SynchronousCompositor::Frame frame;
frame.frame.reset(new cc::CompositorFrame);
SyncCompositorCommonRendererParams common_renderer_params;
- if (!sender_->Send(new SyncCompositorMsg_DemandDrawHw(
- routing_id_, params, &common_renderer_params,
- &frame.output_surface_id, frame.frame.get()))) {
- return SynchronousCompositor::Frame();
- }
- ProcessCommonParams(common_renderer_params);
- 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;
+
+ /* 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));
+ /* Now that the sent message is async, the following processing
+ * of the result has to be done upon receiving the reply. */
+
+ // ProcessCommonParams(common_renderer_params);
+ // 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;
+ //
+ return nullptr;
+}
+
+void SynchronousCompositorHost::ReceiveFrame(
+ content::SyncCompositorCommonRendererParams params,
+ uint32_t output_surface_id,
+ cc::CompositorFrame) {
+ // TODO: the return message is received in this class, but
+ // the received frame should be processed in BVR class (should it?)
+ // because other data is stored there (e.g. current frame consumer)
+ //
+ // Either:
+ // 1. pass the received frame back to browser view renderer (is it
+ // appropriate?)
+ // or
+ // 2. pass the necessary things from bvr to here
}
void SynchronousCompositorHost::UpdateFrameMetaData(

Powered by Google App Engine
This is Rietveld 408576698