Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc

Issue 2930583002: Add Foreground-to-FirstMeaningfulPaint histogram (Closed)
Patch Set: add FCP variant Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/page_load_metrics_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc
diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc
index 08ce2edad84e68cebaf78537d9692e9701aa216e..b8d9232578a8584343dd8ce37dd772ee96b61934 100644
--- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc
@@ -188,6 +188,10 @@ const char kHistogramFailedProvisionalLoad[] =
const char kHistogramForegroundToFirstPaint[] =
"PageLoad.PaintTiming.ForegroundToFirstPaint";
+const char kHistogramForegroundToFirstContentfulPaint[] =
+ "PageLoad.PaintTiming.ForegroundToFirstContentfulPaint";
+const char kHistogramForegroundToFirstMeaningfulPaint[] =
+ "PageLoad.Experimental.PaintTiming.ForegroundToFirstMeaningfulPaint";
const char kHistogramCacheRequestPercentParseStop[] =
"PageLoad.Experimental.Cache.RequestPercent.ParseStop";
@@ -338,16 +342,8 @@ void CorePageLoadMetricsObserver::OnFirstPaintInPage(
timing.paint_timing->first_paint.value());
}
- // Record the time to first paint for pages which were:
- // - Opened in the background.
- // - Moved to the foreground prior to the first paint.
- // - Not moved back to the background prior to the first paint.
- if (!info.started_in_foreground && info.first_foreground_time &&
- info.first_foreground_time.value() <=
- timing.paint_timing->first_paint.value() &&
- (!info.first_background_time ||
- timing.paint_timing->first_paint.value() <=
- info.first_background_time.value())) {
+ if (WasStartedInBackgroundOptionalEventInForeground(
+ timing.paint_timing->first_paint, info)) {
PAGE_LOAD_HISTOGRAM(internal::kHistogramForegroundToFirstPaint,
timing.paint_timing->first_paint.value() -
info.first_foreground_time.value());
@@ -470,6 +466,13 @@ void CorePageLoadMetricsObserver::OnFirstContentfulPaintInPage(
timing.paint_timing->first_contentful_paint.value() -
timing.parse_timing->parse_start.value());
}
+
+ if (WasStartedInBackgroundOptionalEventInForeground(
+ timing.paint_timing->first_contentful_paint, info)) {
+ PAGE_LOAD_HISTOGRAM(internal::kHistogramForegroundToFirstContentfulPaint,
+ timing.paint_timing->first_contentful_paint.value() -
+ info.first_foreground_time.value());
+ }
}
void CorePageLoadMetricsObserver::OnFirstMeaningfulPaintInMainFrameDocument(
@@ -495,6 +498,13 @@ void CorePageLoadMetricsObserver::OnFirstMeaningfulPaintInMainFrameDocument(
RecordFirstMeaningfulPaintStatus(
internal::FIRST_MEANINGFUL_PAINT_BACKGROUNDED);
}
+
+ if (WasStartedInBackgroundOptionalEventInForeground(
+ timing.paint_timing->first_meaningful_paint, info)) {
+ PAGE_LOAD_HISTOGRAM(internal::kHistogramForegroundToFirstMeaningfulPaint,
+ timing.paint_timing->first_meaningful_paint.value() -
+ info.first_foreground_time.value());
+ }
} else {
RecordFirstMeaningfulPaintStatus(
internal::FIRST_MEANINGFUL_PAINT_USER_INTERACTION_BEFORE_FMP);
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/page_load_metrics_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698