You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When the pref for largest_contentful_paint_enabled is enabled, LargestContentfulPaintCandidateCollector is created once per LayoutThread using viewport_size.
While building the display_list, it send the pre-calculated clip_rect and bounds to LCPCollector along with transform and LCPCandidateType for visual_rect calculation for LCPCandidates.
After visual_rect calculation, update the lcp_candidate based on area of visual_rect and send it to compositor.
Then among lcp_candidates, we find out the largest_contentful_paint and send it to paint_metric
In addition to above LCP also uses PaintMetricState to save console from spamming with duplicate entries.
This PR includes following commits better segregation of code
Add LargestContentfulPaintCandidate struct
Add LargestContentfulPaintCandidateCollector
Collect the LargestContentfulPaintCandidateswhen feature is enabled.
Send the LargestContentfulPaintCandidates to compositor
The reason will be displayed to describe this comment to others. Learn more.
Thanks for completing this PR!
I'm still wondering if it's the best choice to tightly couple LCP calculation with display list computation in this way. @mrobinson@Loirooriol could you give your insights?
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Steps for calculating LCP:
largest_contentful_paint_enabledis enabled,LargestContentfulPaintCandidateCollectoris created once per LayoutThread usingviewport_size.display_list, it send the pre-calculatedclip_rectandboundstoLCPCollectoralong withtransformandLCPCandidateTypeforvisual_rectcalculation forLCPCandidates.visual_rectcalculation, update thelcp_candidatebased onareaofvisual_rectand send it tocompositor.lcp_candidates, we find out thelargest_contentful_paintand send it topaint_metricLCPalso usesPaintMetricStateto save console from spamming with duplicate entries.This PR includes following commits better segregation of code
LargestContentfulPaintCandidatestructLargestContentfulPaintCandidateCollectorLargestContentfulPaintCandidateswhen feature is enabled.LargestContentfulPaintCandidatesto compositorLargestContentfulPaintCalculatorLargestContentfulPaintLCPtoPaintMetricsLCPfeature on user interactionElements considered for LCP in this PR:
Reference: #38041
Testing: Tested using perf-analysis-tools See attached screenshot.
Fixes: None
Perfetto

Console Output of Metric
