Chromium Code Reviews| Index: components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.cc b/components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| index d3fe69e669953277f15f8f5de20f61e7ca94375c..c4e866e515e2ae1b7f37f2a588086eed404b1abe 100644 |
| --- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| +++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| @@ -84,6 +84,14 @@ void RecordInternalError(InternalErrorLoadEvent event) { |
| "PageLoad.Events.InternalError", event, ERR_LAST_ENTRY); |
| } |
| +base::TimeDelta FirstContentfulPaint(const PageLoadTiming& timing) { |
|
kinuko
2015/10/29 07:14:04
naming-nit: GetFirstContent... ?
Kunihiko Sakamoto
2015/10/29 08:00:09
Done.
|
| + if (timing.first_text_paint.is_zero()) |
| + return timing.first_image_paint; |
| + if (timing.first_image_paint.is_zero()) |
| + return timing.first_text_paint; |
| + return std::min(timing.first_text_paint, timing.first_image_paint); |
| +} |
| + |
| } // namespace |
| PageLoadTracker::PageLoadTracker( |
| @@ -241,6 +249,18 @@ void PageLoadTracker::RecordTimingHistograms() { |
| timing_.first_image_paint); |
| } |
| } |
| + base::TimeDelta first_contentful_paint = FirstContentfulPaint(timing_); |
| + if (!first_contentful_paint.is_zero()) { |
| + if (first_contentful_paint < background_delta) { |
| + PAGE_LOAD_HISTOGRAM("PageLoad.Timing2.NavigationToFirstContentfulPaint", |
| + first_contentful_paint); |
| + } else { |
| + PAGE_LOAD_HISTOGRAM( |
| + "PageLoad.Timing2.NavigationToFirstContentfulPaint.Background", |
| + first_contentful_paint); |
| + } |
| + } |
| + |
| // Log time to first foreground / time to first background. Log counts that we |
| // started a relevant page load in the foreground / background. |
| if (!background_time_.is_null()) { |