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 2961f1ecb5dd766e48da0cd1dc87bd6f8ba53cb7..71ceebcac1fc9d20014fb3868780ce7ccd31ed16 100644 |
| --- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| +++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| @@ -17,6 +17,8 @@ |
| #include "content/public/browser/web_contents_user_data.h" |
| #include "ipc/ipc_message.h" |
| #include "ipc/ipc_message_macros.h" |
| +#include "net/base/swr_histogram_domains/swr_histogram_domains.h" |
| +#include "url/gurl.h" |
| DEFINE_WEB_CONTENTS_USER_DATA_KEY( |
| page_load_metrics::MetricsWebContentsObserver); |
| @@ -64,7 +66,9 @@ base::Time WallTimeFromTimeTicks(base::TimeTicks time) { |
| base::TimeDelta::FromMinutes(10), 100) |
| PageLoadTracker::PageLoadTracker(bool in_foreground) |
| - : has_commit_(false), started_in_foreground_(in_foreground) { |
| + : has_commit_(false), |
| + started_in_foreground_(in_foreground), |
| + include_in_stale_while_revalidate_experiment_(false) { |
| RecordEvent(PAGE_LOAD_STARTED); |
| } |
| @@ -89,6 +93,10 @@ void PageLoadTracker::Commit() { |
| has_commit_ = true; |
| } |
| +void PageLoadTracker::IncludeInStaleWhileRevalidateExperiment() { |
| + include_in_stale_while_revalidate_experiment_ = true; |
|
Bryan McQuade
2015/10/19 12:58:16
just FYI (happened to find this CL): we don't want
Adam Rice
2015/10/19 13:34:44
SGTM.
|
| +} |
| + |
| bool PageLoadTracker::UpdateTiming(const PageLoadTiming& timing) { |
| // Throw away IPCs that are not relevant to the current navigation. |
| if (!timing_.navigation_start.is_null() && |
| @@ -134,6 +142,12 @@ void PageLoadTracker::RecordTimingHistograms() { |
| PAGE_LOAD_HISTOGRAM("PageLoad.Timing2.NavigationToLoadEventFired.BG", |
| timing_.load_event_start); |
| } |
| + if (include_in_stale_while_revalidate_experiment_) { |
| + PAGE_LOAD_HISTOGRAM( |
|
tyoshino (SeeGerritForStatus)
2015/10/30 07:48:02
no need to align with the grouping above? bg or no
Adam Rice
2015/11/02 13:53:54
When I tested manually, the BG or not BG distincti
Bryan McQuade
2015/11/02 14:22:39
That seems like a bug. Can you open a bug with you
|
| + "PageLoad.Timing2.NavigationToLoadEventFired_" |
| + "StaleWhileRevalidateExperiment", |
| + timing_.load_event_start); |
| + } |
| } |
| if (!timing_.first_layout.is_zero()) { |
| if (timing_.first_layout < background_delta) { |
| @@ -145,6 +159,12 @@ void PageLoadTracker::RecordTimingHistograms() { |
| timing_.first_layout); |
| RecordEvent(PAGE_LOAD_SUCCESSFUL_FIRST_LAYOUT_BACKGROUND); |
| } |
| + if (include_in_stale_while_revalidate_experiment_) { |
| + PAGE_LOAD_HISTOGRAM( |
| + "PageLoad.Timing2.NavigationToFirstLayout_" |
| + "StaleWhileRevalidateExperiment", |
| + timing_.first_layout); |
| + } |
| } |
| if (!timing_.first_text_paint.is_zero()) { |
| if (timing_.first_text_paint < background_delta) { |
| @@ -154,6 +174,12 @@ void PageLoadTracker::RecordTimingHistograms() { |
| PAGE_LOAD_HISTOGRAM("PageLoad.Timing2.NavigationToFirstTextPaint.BG", |
| timing_.first_text_paint); |
| } |
| + if (include_in_stale_while_revalidate_experiment_) { |
| + PAGE_LOAD_HISTOGRAM( |
| + "PageLoad.Timing2.NavigationToFirstTextPaint_" |
| + "StaleWhileRevalidateExperiment", |
| + timing_.first_text_paint); |
| + } |
| } |
| } |
| @@ -222,6 +248,11 @@ void MetricsWebContentsObserver::DidFinishNavigation( |
| if (!IsRelevantNavigation(navigation_handle)) |
| return; |
| + if (net::swr_histogram_domains::IsHostInSWRHistogramDomain( |
| + navigation_handle->GetURL().host())) { |
| + finished_nav->IncludeInStaleWhileRevalidateExperiment(); |
| + } |
| + |
| committed_load_ = finished_nav.Pass(); |
| committed_load_->Commit(); |
| } |