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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_metrics_util.h

Issue 2930583002: Add Foreground-to-FirstMeaningfulPaint histogram (Closed)
Patch Set: add FCP variant Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_
7 7
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/optional.h" 9 #include "base/optional.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // When a page is backgrounded, some events (e.g. paint) are delayed. Since 98 // When a page is backgrounded, some events (e.g. paint) are delayed. Since
99 // these data points can skew the mean, they should not be mixed with timing 99 // these data points can skew the mean, they should not be mixed with timing
100 // events that occurred in the foreground. 100 // events that occurred in the foreground.
101 // If the event time delta and background time delta are equal, we still 101 // If the event time delta and background time delta are equal, we still
102 // consider the event to be logged in the foreground histogram since any 102 // consider the event to be logged in the foreground histogram since any
103 // background specific handling would not yet have been applied to that event. 103 // background specific handling would not yet have been applied to that event.
104 bool WasStartedInForegroundOptionalEventInForeground( 104 bool WasStartedInForegroundOptionalEventInForeground(
105 const base::Optional<base::TimeDelta>& event, 105 const base::Optional<base::TimeDelta>& event,
106 const PageLoadExtraInfo& info); 106 const PageLoadExtraInfo& info);
107 107
108 // Returns true if:
109 // - We have timing information for the event.
110 // - The page load started in the background.
111 // - Moved to the foreground prior to the event.
112 // - Not moved back to the background prior to the event.
113 bool WasStartedInBackgroundOptionalEventInForeground(
114 const base::Optional<base::TimeDelta>& event,
115 const PageLoadExtraInfo& info);
116
108 PageAbortInfo GetPageAbortInfo(const PageLoadExtraInfo& info); 117 PageAbortInfo GetPageAbortInfo(const PageLoadExtraInfo& info);
109 118
110 // Get the duration of time that the page spent in the foreground, from 119 // Get the duration of time that the page spent in the foreground, from
111 // navigation start until one of the following events: 120 // navigation start until one of the following events:
112 // * the load of the main resource fails 121 // * the load of the main resource fails
113 // * the page load is stopped 122 // * the page load is stopped
114 // * the tab hosting the page is closed 123 // * the tab hosting the page is closed
115 // * the render process hosting the page goes away 124 // * the render process hosting the page goes away
116 // * a new navigation which later commits is initiated in the same tab 125 // * a new navigation which later commits is initiated in the same tab
117 // * the tab hosting the page is backgrounded 126 // * the tab hosting the page is backgrounded
118 base::Optional<base::TimeDelta> GetInitialForegroundDuration( 127 base::Optional<base::TimeDelta> GetInitialForegroundDuration(
119 const PageLoadExtraInfo& info, 128 const PageLoadExtraInfo& info,
120 base::TimeTicks app_background_time); 129 base::TimeTicks app_background_time);
121 130
122 // Whether the given loading behavior was observed in any frame (either the main 131 // Whether the given loading behavior was observed in any frame (either the main
123 // frame or a subframe). 132 // frame or a subframe).
124 bool DidObserveLoadingBehaviorInAnyFrame( 133 bool DidObserveLoadingBehaviorInAnyFrame(
125 const page_load_metrics::PageLoadExtraInfo& info, 134 const page_load_metrics::PageLoadExtraInfo& info,
126 blink::WebLoadingBehaviorFlag behavior); 135 blink::WebLoadingBehaviorFlag behavior);
127 136
128 } // namespace page_load_metrics 137 } // namespace page_load_metrics
129 138
130 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ 139 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698