viz: Implement surface synchronization for OOPIFs
This CL implements surface synchronization for out-of-process iframes and <webview>.
RenderFrameProxy waits until there is a single frame guaranteed to be available in the
display compositor before using surface synchronization. Once there's an available fallback
surface that can be employed, then the primary surface is updated as soon as the frame rect
changes. The compositing system will attempt to composite the primary surface within a given
deadline (4 frames is the default). If the primary surface isn't available for four frames,
then the fallback surface will be used.
In order to construct a SurfaceId for the primary SurfaceInfo, both a FrameSinkId and
LocalSurfaceId must be available in RenderFrameProxy. The FrameSinkId changes every time
the RenderWidgetHostViewChildFrame changes and so we propagate the FrameSinkId of the view
up to the proxy on ViewChange.
Finally, the iframe's embedder (typically a top level page) fallback is not available for some
period of time until "OnFirstSurfaceActivation". When no clients are using surface synchronization,
then the fallback can be set immediately. However, because RWHVAura can have children that
synchronize, the fallback surface will not be available immediately. In order to ensure that
frames aren't missed in SurfaceAggregator, we don't update the fallback in DelegatedFrameHost until
the surface activates in OnFirstSurfaceActivation.
Bug: 672962
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation
Change-Id: I42c4c5fa312d9aed08ff34b07c4d04d311a2eff5
Reviewed-on: https://chromium-review.googlesource.com/639366
Reviewed-by: Antoine Labour <[email protected]>
Reviewed-by: Ken Buchanan <[email protected]>
Commit-Queue: Fady Samuel <[email protected]>
Cr-Commit-Position: refs/heads/master@{#498164}
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc
index 8fad0fb1..b8440c9 100644
--- a/content/renderer/child_frame_compositing_helper.cc
+++ b/content/renderer/child_frame_compositing_helper.cc
@@ -275,6 +275,7 @@
viz::SurfaceInfo modified_surface_info(surface_info.id(), scale_factor,
surface_info.size_in_pixels());
surface_layer_->SetPrimarySurfaceInfo(modified_surface_info);
+ surface_layer_->SetFallbackSurfaceInfo(fallback_surface_info_);
std::unique_ptr<cc_blink::WebLayerImpl> layer(
new cc_blink::WebLayerImpl(surface_layer_));
@@ -294,6 +295,7 @@
void ChildFrameCompositingHelper::SetFallbackSurfaceInfo(
const viz::SurfaceInfo& surface_info,
const viz::SurfaceSequence& sequence) {
+ fallback_surface_info_ = surface_info;
float scale_factor = surface_info.device_scale_factor();
// TODO(oshima): This is a stopgap fix so that the compositor does not
// scaledown the content when 2x frame data is added to 1x parent frame data.