From 1e720d2f120ba0cf3293a642285af3d9d987f28e Mon Sep 17 00:00:00 2001 From: wjmaclean Date: Tue, 14 Jul 2015 09:09:52 -0700 Subject: DelegatedFrameHost should handle satisfied sequences in frame metadata. When a RenderWidgetHostViewAura is acting as a guest view, it may need to process satisifed sequences, received in the frame metadata, for its embedder. This CL adds the satsfied sequence list to the data passed to SwapDelegatedFrame() and includes it in the metadata subsequently passed to SubmitFrame(). The CL also adds a dedicated BrowserPlugin satisfy callback in ChildFrameCompositingHelper, just to make sure that these callbacks are routed properly. BUG=503594 Review URL: https://codereview.chromium.org/1229413003 Cr-Commit-Position: refs/heads/master@{#338696} --- content/browser/compositor/delegated_frame_host.cc | 4 +++- content/browser/compositor/delegated_frame_host.h | 5 ++++- .../renderer_host/render_widget_host_view_aura.cc | 3 ++- .../renderer_host/render_widget_host_view_mac.mm | 3 ++- content/renderer/child_frame_compositing_helper.cc | 19 +++++++++++++++++-- content/renderer/child_frame_compositing_helper.h | 5 +++++ 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc index e30af30..903f7a0 100644 --- a/content/browser/compositor/delegated_frame_host.cc +++ b/content/browser/compositor/delegated_frame_host.cc @@ -299,7 +299,8 @@ void DelegatedFrameHost::SwapDelegatedFrame( uint32 output_surface_id, scoped_ptr frame_data, float frame_device_scale_factor, - const std::vector& latency_info) { + const std::vector& latency_info, + std::vector* satisfies_sequences) { DCHECK(!frame_data->render_pass_list.empty()); cc::RenderPass* root_pass = frame_data->render_pass_list.back(); @@ -400,6 +401,7 @@ void DelegatedFrameHost::SwapDelegatedFrame( compositor_frame->metadata.latency_info.end(), latency_info.begin(), latency_info.end()); + compositor_frame->metadata.satisfies_sequences.swap(*satisfies_sequences); gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) diff --git a/content/browser/compositor/delegated_frame_host.h b/content/browser/compositor/delegated_frame_host.h index 0d90612..bfde8f2 100644 --- a/content/browser/compositor/delegated_frame_host.h +++ b/content/browser/compositor/delegated_frame_host.h @@ -119,11 +119,14 @@ class CONTENT_EXPORT DelegatedFrameHost bool CanCopyToBitmap() const; // Public interface exposed to RenderWidgetHostView. + + // Note: |satisfies_sequences| is cleared in calls to this function. void SwapDelegatedFrame( uint32 output_surface_id, scoped_ptr frame_data, float frame_device_scale_factor, - const std::vector& latency_info); + const std::vector& latency_info, + std::vector* satifies_sequences); void WasHidden(); void WasShown(const ui::LatencyInfo& latency_info); void WasResized(); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 009ce15..ae83db3 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -1176,7 +1176,8 @@ void RenderWidgetHostViewAura::OnSwapCompositorFrame( output_surface_id, frame->delegated_frame_data.Pass(), frame->metadata.device_scale_factor, - frame->metadata.latency_info); + frame->metadata.latency_info, + &frame->metadata.satisfies_sequences); return; } diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 91c9fd9..b060993 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -1506,7 +1506,8 @@ void RenderWidgetHostViewMac::OnSwapCompositorFrame( output_surface_id, frame->delegated_frame_data.Pass(), frame->metadata.device_scale_factor, - frame->metadata.latency_info); + frame->metadata.latency_info, + &frame->metadata.satisfies_sequences); } else { DLOG(ERROR) << "Received unexpected frame type."; bad_message::ReceivedBadMessage(render_widget_host_->GetProcess(), diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc index e6a3fab..adec05b 100644 --- a/content/renderer/child_frame_compositing_helper.cc +++ b/content/renderer/child_frame_compositing_helper.cc @@ -279,6 +279,16 @@ void ChildFrameCompositingHelper::SatisfyCallback( } // static +void ChildFrameCompositingHelper::SatisfyCallbackBrowserPlugin( + scoped_refptr sender, + int host_routing_id, + int browser_plugin_instance_id, + cc::SurfaceSequence sequence) { + sender->Send(new BrowserPluginHostMsg_SatisfySequence( + host_routing_id, browser_plugin_instance_id, sequence)); +} + +// static void ChildFrameCompositingHelper::RequireCallback( scoped_refptr sender, int host_routing_id, @@ -316,8 +326,13 @@ void ChildFrameCompositingHelper::OnSetSurface( scoped_refptr sender( RenderThreadImpl::current()->thread_safe_sender()); cc::SurfaceLayer::SatisfyCallback satisfy_callback = - base::Bind(&ChildFrameCompositingHelper::SatisfyCallback, sender, - host_routing_id_); + render_frame_proxy_ + ? base::Bind(&ChildFrameCompositingHelper::SatisfyCallback, sender, + host_routing_id_) + : base::Bind( + &ChildFrameCompositingHelper::SatisfyCallbackBrowserPlugin, + sender, host_routing_id_, + browser_plugin_->browser_plugin_instance_id()); cc::SurfaceLayer::RequireCallback require_callback = render_frame_proxy_ ? base::Bind(&ChildFrameCompositingHelper::RequireCallback, sender, diff --git a/content/renderer/child_frame_compositing_helper.h b/content/renderer/child_frame_compositing_helper.h index a6fb0f03..ffd34be 100644 --- a/content/renderer/child_frame_compositing_helper.h +++ b/content/renderer/child_frame_compositing_helper.h @@ -110,6 +110,11 @@ class CONTENT_EXPORT ChildFrameCompositingHelper static void SatisfyCallback(scoped_refptr sender, int host_routing_id, cc::SurfaceSequence sequence); + static void SatisfyCallbackBrowserPlugin( + scoped_refptr sender, + int host_routing_id, + int browser_plugin_instance_id, + cc::SurfaceSequence sequence); static void RequireCallback(scoped_refptr sender, int host_routing_id, cc::SurfaceId id, -- cgit v1.1