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 PageLoadTiming; | 18 struct PageLoadTiming; |
19 | 19 |
20 // Get the time of the first 'contentful' paint. A contentful paint is a paint | 20 // Get the time of the first 'contentful' paint. A contentful paint is a paint |
21 // that includes content of some kind (for example, text or image content). | 21 // that includes content of some kind (for example, text or image content). |
22 // Painting of a background color is not considered 'contentful'. | 22 // Painting of a background color is not considered 'contentful'. |
23 base::TimeDelta GetFirstContentfulPaint(const PageLoadTiming& timing); | 23 base::TimeDelta GetFirstContentfulPaint(const PageLoadTiming& timing); |
24 | 24 |
25 // Returns false for events for which we have no timing information, and events | |
26 // that happened after the page was backgrounded. When a page is backgrounded, | |
27 // the priority is lowered, and the load timing events no longer reflect the | |
Charlie Harrison
2015/12/08 20:26:21
I don't know if the priority is always lowered. rd
Adam Rice
2015/12/09 06:29:00
I reworded the comment. PTAL.
| |
28 // user experience. Since these data points can skew the mean, they should not | |
29 // be mixed with timing events that occurred in the foreground. | |
30 bool EventOccurredInForeground(const base::TimeDelta& event, | |
31 const base::TimeDelta& first_background); | |
32 | |
25 } // namespace page_load_metrics | 33 } // namespace page_load_metrics |
26 | 34 |
27 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ | 35 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_UTIL_H_ |
OLD | NEW |