| 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 d4d6ea2cc84113efbccc819c87a53fbd9d1c9818..139b36225abceba7387222e34b1a36e15b9d5924 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
|
| @@ -137,7 +137,7 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| if (info.started_in_foreground && !info.first_background_time.is_zero() &&
|
| (timing.first_paint.is_zero() ||
|
| timing.first_paint > info.first_background_time)) {
|
| - if (!info.time_to_commit.is_zero()) {
|
| + if (info.committed) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramBackgroundBeforePaint,
|
| info.first_background_time);
|
| } else {
|
| @@ -149,7 +149,7 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| if (failed_provisional_load_info_.error != net::OK) {
|
| // Ignores a background failed provisional load.
|
| if (WasStartedInForegroundEventInForeground(
|
| - failed_provisional_load_info_.interval, info)) {
|
| + failed_provisional_load_info_.interval, false, info)) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramFailedProvisionalLoad,
|
| failed_provisional_load_info_.interval);
|
| }
|
| @@ -158,10 +158,16 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| // The rest of the histograms require the load to have committed and be
|
| // relevant. If |timing.IsEmpty()|, then this load was not tracked by the
|
| // renderer.
|
| - if (info.time_to_commit.is_zero() || timing.IsEmpty())
|
| + if (!info.committed || timing.IsEmpty())
|
| return;
|
|
|
| - if (WasStartedInForegroundEventInForeground(info.time_to_commit, info)) {
|
| + // WasStartedInForegroundEventInForeground uses info.time_to_commit.is_zero()
|
| + // to determine whether the load has committed but time_to_commit might be
|
| + // zero in this case, so add explicit check here for that.
|
| + // See crbug.com/596367 for details.
|
| + // TODO(csharrison): Clean up tests that rely on this.
|
| + if (WasStartedInForegroundEventInForeground(info.time_to_commit,
|
| + info.committed, info)) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramCommit, info.time_to_commit);
|
| } else {
|
| PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramCommit,
|
| @@ -169,7 +175,7 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| }
|
| if (!timing.dom_content_loaded_event_start.is_zero()) {
|
| if (WasStartedInForegroundEventInForeground(
|
| - timing.dom_content_loaded_event_start, info)) {
|
| + timing.dom_content_loaded_event_start, false, info)) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramDomContentLoaded,
|
| timing.dom_content_loaded_event_start);
|
| PAGE_LOAD_HISTOGRAM(
|
| @@ -181,7 +187,7 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| }
|
| }
|
| if (!timing.load_event_start.is_zero()) {
|
| - if (WasStartedInForegroundEventInForeground(timing.load_event_start,
|
| + if (WasStartedInForegroundEventInForeground(timing.load_event_start, false,
|
| info)) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramLoad, timing.load_event_start);
|
| } else {
|
| @@ -190,7 +196,8 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| }
|
| }
|
| if (!timing.first_layout.is_zero()) {
|
| - if (WasStartedInForegroundEventInForeground(timing.first_layout, info)) {
|
| + if (WasStartedInForegroundEventInForeground(timing.first_layout, false,
|
| + info)) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstLayout, timing.first_layout);
|
| } else {
|
| PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramFirstLayout,
|
| @@ -198,7 +205,8 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| }
|
| }
|
| if (!timing.first_paint.is_zero()) {
|
| - if (WasStartedInForegroundEventInForeground(timing.first_paint, info)) {
|
| + if (WasStartedInForegroundEventInForeground(timing.first_paint, false,
|
| + info)) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstPaint, timing.first_paint);
|
| } else {
|
| PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramFirstPaint,
|
| @@ -219,7 +227,7 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| }
|
| }
|
| if (!timing.first_text_paint.is_zero()) {
|
| - if (WasStartedInForegroundEventInForeground(timing.first_text_paint,
|
| + if (WasStartedInForegroundEventInForeground(timing.first_text_paint, false,
|
| info)) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstTextPaint,
|
| timing.first_text_paint);
|
| @@ -229,7 +237,7 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| }
|
| }
|
| if (!timing.first_image_paint.is_zero()) {
|
| - if (WasStartedInForegroundEventInForeground(timing.first_image_paint,
|
| + if (WasStartedInForegroundEventInForeground(timing.first_image_paint, false,
|
| info)) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstImagePaint,
|
| timing.first_image_paint);
|
| @@ -240,7 +248,7 @@ void CorePageLoadMetricsObserver::RecordTimingHistograms(
|
| }
|
| if (!timing.first_contentful_paint.is_zero()) {
|
| if (WasStartedInForegroundEventInForeground(timing.first_contentful_paint,
|
| - info)) {
|
| + false, info)) {
|
| PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstContentfulPaint,
|
| timing.first_contentful_paint);
|
| // Bucket these histograms into high/low resolution clock systems. This
|
| @@ -285,12 +293,12 @@ void CorePageLoadMetricsObserver::RecordRappor(
|
| rappor::RapporService* rappor_service = g_browser_process->rappor_service();
|
| if (!rappor_service)
|
| return;
|
| - if (info.time_to_commit.is_zero())
|
| + if (!info.committed)
|
| return;
|
| DCHECK(!info.committed_url.is_empty());
|
| // Log the eTLD+1 of sites that show poor loading performance.
|
| if (!WasStartedInForegroundEventInForeground(timing.first_contentful_paint,
|
| - info)) {
|
| + false, info)) {
|
| return;
|
| }
|
| scoped_ptr<rappor::Sample> sample =
|
|
|