Defer reporting FMP timestamp until SwapPromises complete

Desktop / Chromium - Scott Haseley [google.com] - 9 August 2017 01:40 EDT

There are three corner cases with capturing the FMP swap timestamp that this CL addresses:

1) If the provisional FMP timestamp is set, resulting in a queued SwapPromise, and the 2-quiet timer fires before the SwapPromise is fulfilled, then we do not report an FMP timestamp.

2) If the provisional FMP timestamp is set again while still waiting for the previous SwapPromise, resulting in two outstanding SwapPromises, and the 2-quiet timer fires in between SwapPromises, then the wrong FMP swap timestamp will be reported. For example, the following sequence of events can occur: a) Set provisional FMP & queue SwapPromise b) Set provisional FMP & queue SwapPromise c) Recieve SwapPromise result from (a) d) 2-quiet timer fires e) Recieve SwapPromise result from (b) In this case, FMP is reported in (d) using the provisional FMP timestamp from (b), but the SwapPromise timestamp corresponding to (a).

3) If the provisional FMP timestamp is less than the FCP timestamp when the 2-quiet timer fires, we use FCP. However, if this timer fires before the FCP SwapPromise has been fulfilled, then we report no FMP swap timestamp.

To address these corner cases, reporting the FMP timestamp is deferred if we either have any pending SwapPromises when the 2-quiet timer fires or if we use the FCP timestamp but the corresponding FCP-swap timestamp isn't set. In the first case, when the the number of outstanding SwapPromises reaches 0, we report FMP. In the latter case, PaintTiming informs the FirstMeaningfulPaintDetector when the swap timestamp is available, and FMP is reported at that point.

Bug: 741961 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I202e668ab3295f7a1ee2bb10f925e54966b92c18 Reviewed-on: https://chromium-review.googlesource.com/599117

5f78548 Defer reporting FMP timestamp until SwapPromises complete
.../core/paint/FirstMeaningfulPaintDetector.cpp | 64 +++++--
.../core/paint/FirstMeaningfulPaintDetector.h | 9 +
.../paint/FirstMeaningfulPaintDetectorTest.cpp | 196 +++++++++++++++++++--
.../WebKit/Source/core/paint/PaintTiming.cpp | 1 +
third_party/WebKit/Source/core/paint/PaintTiming.h | 3 +
5 files changed, 241 insertions(+), 32 deletions(-)

Upstream: git.chromium.org


  • Share