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

Unified Diff: components/page_load_metrics/browser/metrics_web_contents_observer.cc

Issue 1303973009: [DO NOT COMMIT] Re-use the dafsa code for s-w-r histograms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add histograms to histograms.xml Created 5 years, 2 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
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..89e94f6feb6262ef85aa111ec5aabbd64901f24e 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;
+}
+
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(
+ "PageLoad.Timing2.NavigationToLoadEventFired_"
+ "StaleWhileRevalidateExperiment",
+ timing_.load_event_start);
+ }
}
if (!timing_.first_layout.is_zero()) {
if (timing_.first_layout < background_delta) {
@@ -145,15 +159,28 @@ 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) {
PAGE_LOAD_HISTOGRAM("PageLoad.Timing2.NavigationToFirstTextPaint",
timing_.first_text_paint);
+
tyoshino (SeeGerritForStatus) 2015/10/19 07:15:10 inserted accidentally?
Adam Rice 2015/10/19 12:03:07 Yes. Fixed.
} else {
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 +249,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();
}

Powered by Google App Engine
This is Rietveld 408576698