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

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

Issue 1507813002: Don't log background navigations in StaleWhileRevalidateExperiment histograms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make EventOccurredInForeground take a PageLoadExtraInfo object. Created 5 years 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/observers/stale_while_revalidate_metrics_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
diff --git a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
index da8046aa770ac281e62ba05efefc51798d0168ef..d3c393430dbf816e88d435d2f37c9e87fd9826d1 100644
--- a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
@@ -49,12 +49,6 @@ bool IsFromGoogleSearchResult(const GURL& url, const GURL& referrer) {
return is_possible_search_referrer && !IsFromGoogle(url);
}
-bool ShouldLogEvent(const base::TimeDelta& event,
- const base::TimeDelta& first_background) {
- return !event.is_zero() &&
- (first_background.is_zero() || event < first_background);
-}
-
} // namespace
FromGWSPageLoadMetricsObserver::FromGWSPageLoadMetricsObserver(
@@ -70,46 +64,45 @@ void FromGWSPageLoadMetricsObserver::OnCommit(
void FromGWSPageLoadMetricsObserver::OnComplete(
const page_load_metrics::PageLoadTiming& timing,
const page_load_metrics::PageLoadExtraInfo& extra_info) {
+ using page_load_metrics::EventOccurredInForeground;
+
if (!navigation_from_gws_)
return;
- // Filter out navigations that started in the background.
- if (!extra_info.started_in_foreground)
- return;
- const base::TimeDelta& first_background = extra_info.first_background_time;
- if (ShouldLogEvent(timing.dom_content_loaded_event_start, first_background)) {
+ if (EventOccurredInForeground(timing.dom_content_loaded_event_start,
+ extra_info)) {
PAGE_LOAD_HISTOGRAM(
"PageLoad.Clients.FromGWS.Timing2."
"NavigationToDOMContentLoadedEventFired",
timing.dom_content_loaded_event_start);
}
- if (ShouldLogEvent(timing.load_event_start, first_background)) {
+ if (EventOccurredInForeground(timing.load_event_start, extra_info)) {
PAGE_LOAD_HISTOGRAM(
"PageLoad.Clients.FromGWS.Timing2.NavigationToLoadEventFired",
timing.load_event_start);
}
- if (ShouldLogEvent(timing.first_layout, first_background)) {
+ if (EventOccurredInForeground(timing.first_layout, extra_info)) {
PAGE_LOAD_HISTOGRAM(
"PageLoad.Clients.FromGWS.Timing2.NavigationToFirstLayout",
timing.first_layout);
}
- if (ShouldLogEvent(timing.first_text_paint, first_background)) {
+ if (EventOccurredInForeground(timing.first_text_paint, extra_info)) {
PAGE_LOAD_HISTOGRAM(
"PageLoad.Clients.FromGWS.Timing2.NavigationToFirstTextPaint",
timing.first_text_paint);
}
- if (ShouldLogEvent(timing.first_image_paint, first_background)) {
+ if (EventOccurredInForeground(timing.first_image_paint, extra_info)) {
PAGE_LOAD_HISTOGRAM(
"PageLoad.Clients.FromGWS.Timing2.NavigationToFirstImagePaint",
timing.first_image_paint);
}
- if (ShouldLogEvent(timing.first_paint, first_background)) {
+ if (EventOccurredInForeground(timing.first_paint, extra_info)) {
PAGE_LOAD_HISTOGRAM(
"PageLoad.Clients.FromGWS.Timing2.NavigationToFirstPaint",
timing.first_paint);
}
base::TimeDelta first_contentful_paint = GetFirstContentfulPaint(timing);
- if (ShouldLogEvent(first_contentful_paint, first_background)) {
+ if (EventOccurredInForeground(first_contentful_paint, extra_info)) {
PAGE_LOAD_HISTOGRAM(
"PageLoad.Clients.FromGWS.Timing2.NavigationToFirstContentfulPaint",
first_contentful_paint);
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/observers/stale_while_revalidate_metrics_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698