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

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: 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/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 faca49c3ed948ced19929a5e7c97b3f581750c65..d13115fae570b3ee82c4e663c690cba77deb32a8 100644
--- a/content/browser/android/synchronous_compositor_host.cc
+++ b/content/browser/android/synchronous_compositor_host.cc
@@ -90,11 +90,25 @@ 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_Async(
+ const gfx::Size& viewport_size,
+ const gfx::Rect& viewport_rect_for_tile_priority,
+ const gfx::Transform& transform_for_tile_priority) {
+ SyncCompositorDemandDrawHwParams params(viewport_size,
+ viewport_rect_for_tile_priority,
+ transform_for_tile_priority);
+ sender_->Send(new CompositorMsg_DemandDrawHw(routing_id_, params));
+
+ SynchronousCompositor::Frame frame;
+ return frame;
+}
+
SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw(
const gfx::Size& viewport_size,
const gfx::Rect& viewport_rect_for_tile_priority,
@@ -121,6 +135,26 @@ SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw(
return frame;
}
+void SynchronousCompositorHost::DemandDrawHwReceiveFrame(
+ uint32_t output_surface_id,
+ const cc::CompositorFrame& compositor_frame) {
+ SynchronousCompositor::Frame frame;
+ frame.frame.reset(new cc::CompositorFrame);
+ frame.output_surface_id = output_surface_id;
+ *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());
+ }
+
+ client_->OnDrawHardwareProcessFrame(std::move(frame));
+}
+
void SynchronousCompositorHost::UpdateFrameMetaData(
cc::CompositorFrameMetadata frame_metadata) {
rwhva_->SynchronousFrameMetadata(std::move(frame_metadata));

Powered by Google App Engine
This is Rietveld 408576698