Add basic support for lazily loading below the fold cross-origin iframes
This CL adds basic support (behind a flag) for deferring the load of cross-origin frames until the user scrolls near them, in order to reduce network data usage, memory usage, and speed up the loading of other content on the page. When a frame is deferred, an IntersectionObserver is used to detect when the deferred frame element is within a specific distance threshold of the viewport and resume loading the frame. Currently, this distance-from-viewport threshold is hardcoded, but in future CLs it will be supplied from a field trial parameter. Heuristics (i.e. tiny dimensions or offscreen position) are used to recognize and immediately load frames that are likely used for analytics or inter-frame communication, since those kinds of frames would be broken by deferring them. Once a lazily-loaded frame starts loading in, children within that lazily-loaded frame won't be lazily loaded themselves. This will make it possible for subresources in hidden frames to load that will never be visible, as well as make it so that deferred frames that have multiple layers of iframes inside them can load faster once they're near the viewport or visible. See the design docs below for more info. LazyFrames design doc: https://docs.google.com/document/d/1ITh7UqhmfirprVtjEtpfhga5Qyfoh78UkRmW8r3CntM/edit LazyLoad design doc: https://docs.google.com/document/d/1e8ZbVyUwgIkQMvJma3kKUDg8UUkLRRdANStqKuOIvHg/edit Bug: 635105 Change-Id: I970221f527861298b58ed5b4662eb04019bc86ff Reviewed-on: https://chromium-review.googlesource.com/979256 Commit-Queue: Scott Little <sclittle@chromium.org> Reviewed-by:Daniel Cheng <dcheng@chromium.org> Reviewed-by:
Kinuko Yasuda <kinuko@chromium.org> Cr-Commit-Position: refs/heads/master@{#550317}
Showing
This diff is collapsed.
Please register or sign in to comment