[LCP] Update LCP when both text and image are ready
Largest Contentful Paint compares the text and the image candidate to decide which is the largest candidate. Currently, LCP generates a result entry between updating the text candidate and the image candidate, which produces an intermediate result. It causes the issue in crbug.com/988115, #c4 explains the mechanism of the bug. To remove the intermediate state, this CL changes the way LCP-calculator takes the text candidate and image candidate. Instead of notifying LCP-calculator of the text candidate's update right after the update, we wait until both text candidate and image candidate have been updated to notify LCP-calculator. Also, LCP-calculator adds the logic of checking whether candidate has changed, from ImagePaintTimingDetector and TextPaintTimingDetector. Although it's redundant with |UpdateCandidate| in text and image, these are necessary because going forwards, the "has_changed" logic in both detectors would have to be removed along with the LIP and LTP logic. This CL also considers the chances where either detector is destroyed, where it would no longer be able to find the largest candidate. In this case, perf API would use the last reported candidate as the candidate to compare with the candidate from another detector, in order to decide the largest between text and image. Bug: 982307, 988115 Change-Id: I562c7aeab6037678dd4bd7d6eddacdeb5be8bfbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733456 Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org> Reviewed-by:Steve Kobes <skobes@chromium.org> Cr-Commit-Position: refs/heads/master@{#685300}
Showing
Please register or sign in to comment