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 #include "components/page_load_metrics/browser/page_load_metrics_observer.h" | |
10 | 11 |
11 #define PAGE_LOAD_HISTOGRAM(name, sample) \ | 12 #define PAGE_LOAD_HISTOGRAM(name, sample) \ |
12 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, \ | 13 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, \ |
13 base::TimeDelta::FromMilliseconds(10), \ | 14 base::TimeDelta::FromMilliseconds(10), \ |
14 base::TimeDelta::FromMinutes(10), 100) | 15 base::TimeDelta::FromMinutes(10), 100) |
15 | 16 |
16 namespace page_load_metrics { | 17 namespace page_load_metrics { |
17 | 18 |
18 struct PageLoadExtraInfo; | 19 struct PageLoadExtraInfo; |
19 struct PageLoadTiming; | 20 struct PageLoadTiming; |
20 | 21 |
21 // Get the time of the first 'contentful' paint. A contentful paint is a paint | 22 // Get the time of the first 'contentful' paint. A contentful paint is a paint |
22 // that includes content of some kind (for example, text or image content). | 23 // that includes content of some kind (for example, text or image content). |
23 // Painting of a background color is not considered 'contentful'. | 24 // Painting of a background color is not considered 'contentful'. |
24 base::TimeDelta GetFirstContentfulPaint(const PageLoadTiming& timing); | 25 base::TimeDelta GetFirstContentfulPaint(const PageLoadTiming& timing); |
25 | 26 |
26 // Returns false for events for which we have no timing information, and events | 27 // Input is a TimeDelta assumed to be baselined at navigation start. Returns |
27 // that happened on a page that had been in the background. When a page is | 28 // false for zero durations, and durations that happened on a page that had been |
28 // backgrounded, some events (e.g. paint) are delayed. Since these data points | 29 // in the background. When a page is backgrounded, some events (e.g. paint) are |
29 // can skew the mean, they should not be mixed with timing events that occurred | 30 // delayed. Since these data points can skew the mean, they should not be mixed |
30 // in the foreground. | 31 // with timing events that occurred in the foreground. |
31 bool EventOccurredInForeground(const base::TimeDelta& event, | 32 bool DurationOccurredInForeground(const base::TimeDelta& event, |
kinuko
2015/12/11 12:24:27
I have a feeling that this change is not really re
kinuko
2015/12/11 13:16:45
Some more nit comments in case you want to land th
Charlie Harrison
2015/12/11 14:12:20
I'm fine doing this in another patch. We can figur
Bryan McQuade
2015/12/11 14:13:42
Yeah - doing this in a separate change sounds fine
Charlie Harrison
2015/12/11 14:49:11
Yep, my most recent patch set does not include thi
| |
32 const PageLoadExtraInfo& info); | 33 const PageLoadExtraInfo& info); |
33 | 34 |
34 } // namespace page_load_metrics | 35 } // namespace page_load_metrics |
35 | 36 |
36 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ | 37 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ |
OLD | NEW |