Surface synchronization: Only update primary Surfaceinfo if something changed.
We should not be updating the ChildFrameCompositingHelper's primary SurfaceInfo
unless some synchronized property has changed.
Updating the primary SurfaceInfo induces a commit when nothing might've changed.
Furthermore, Blink gets confused a change is triggered on scroll, and hits a
document lifecycle DCHECK. This CL addresses this by avoiding updating the
SurfaceLayer of the OOPIF/BrowserPlugin unless the size or ScreenInfo has
changed.
Bug: 672962
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I776990691beb2f58b0178c08da617b4bdb6df468
Reviewed-on: https://chromium-review.googlesource.com/759128
Commit-Queue: Fady Samuel <[email protected]>
Reviewed-by: Antoine Labour <[email protected]>
Cr-Commit-Position: refs/heads/master@{#515033}
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc
index 1aef941..4dfd4f6 100644
--- a/content/renderer/child_frame_compositing_helper.cc
+++ b/content/renderer/child_frame_compositing_helper.cc
@@ -263,6 +263,9 @@
void ChildFrameCompositingHelper::SetPrimarySurfaceInfo(
const viz::SurfaceInfo& surface_info) {
+ if (last_primary_surface_id_ == surface_info.id())
+ return;
+
last_primary_surface_id_ = surface_info.id();
float scale_factor = surface_info.device_scale_factor();
// TODO(oshima): This is a stopgap fix so that the compositor does not
@@ -298,6 +301,9 @@
void ChildFrameCompositingHelper::SetFallbackSurfaceInfo(
const viz::SurfaceInfo& surface_info,
const viz::SurfaceSequence& sequence) {
+ if (fallback_surface_id_ == surface_info.id())
+ return;
+
fallback_surface_id_ = surface_info.id();
// The RWHV creates a destruction dependency on the surface that needs to be
// satisfied. The reference factory will satisfy it when a new reference has