OLD | NEW |
---|---|
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 COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ | 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ |
6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ | 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ |
7 | 7 |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 | 10 |
11 #define PAGE_LOAD_HISTOGRAM(name, sample) \ | 11 #define PAGE_LOAD_HISTOGRAM(name, sample) \ |
12 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, \ | 12 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, \ |
13 base::TimeDelta::FromMilliseconds(10), \ | 13 base::TimeDelta::FromMilliseconds(10), \ |
14 base::TimeDelta::FromMinutes(10), 100) | 14 base::TimeDelta::FromMinutes(10), 100) |
15 | 15 |
16 namespace page_load_metrics { | 16 namespace page_load_metrics { |
17 | 17 |
18 struct PageLoadExtraInfo; | 18 struct PageLoadExtraInfo; |
19 struct PageLoadTiming; | 19 struct PageLoadTiming; |
20 | 20 |
21 // Returns false for events for which we have no timing information, and events | 21 // Returns true if: |
22 // that happened on a page that had been in the background. When a page is | 22 // - We have timing information for the event. |
23 // backgrounded, some events (e.g. paint) are delayed. Since these data points | 23 // - The page load started while the page was in the foreground. |
24 // can skew the mean, they should not be mixed with timing events that occurred | 24 // - The event occurred prior to the page being moved to the background. |
25 // in the foreground. | 25 // When a page is backgrounded, some events (e.g. paint) are delayed. Since |
26 bool EventOccurredInForeground(const base::TimeDelta& event, | 26 // these data points can skew the mean, they should not be mixed with timing |
27 const PageLoadExtraInfo& info); | 27 // events that occurred in the foreground. |
28 bool StartInForegroundEventInForeground(base::TimeDelta event, | |
kinuko
2016/02/23 13:10:35
I understand what these methods mean after reading
pkotwicz
2016/02/23 19:04:52
StartInForegroundEventInForeground() represents an
| |
29 const PageLoadExtraInfo& info); | |
30 | |
31 | |
32 // Returns true if: | |
33 // - We have timing information for the event. | |
34 // - The page load started while the page was in the background. | |
35 // - The event occurred after the page was moved to the foreground and prior to | |
36 // the page being moved back to the background. | |
37 bool StartInBackgroundEventInForeground(base::TimeDelta event, | |
38 const PageLoadExtraInfo& info); | |
28 | 39 |
29 } // namespace page_load_metrics | 40 } // namespace page_load_metrics |
30 | 41 |
31 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ | 42 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ |
OLD | NEW |