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/render_frame_proxy.h b/content/renderer/render_frame_proxy.h
index a471d36c..3c203de6 100644
--- a/content/renderer/render_frame_proxy.h
+++ b/content/renderer/render_frame_proxy.h
@@ -169,7 +169,7 @@
void OnSetChildFrameSurface(const viz::SurfaceInfo& surface_info,
const viz::SurfaceSequence& sequence);
void OnUpdateOpener(int opener_routing_id);
- void OnViewChanged();
+ void OnViewChanged(const viz::FrameSinkId& frame_sink_id);
void OnDidStopLoading();
void OnDidUpdateFramePolicy(
blink::WebSandboxFlags flags,
@@ -205,9 +205,12 @@
RenderWidget* render_widget_;
gfx::Rect frame_rect_;
+ viz::FrameSinkId frame_sink_id_;
viz::LocalSurfaceId local_surface_id_;
viz::LocalSurfaceIdAllocator local_surface_id_allocator_;
+ bool enable_surface_synchronization_ = false;
+
DISALLOW_COPY_AND_ASSIGN(RenderFrameProxy);
};