OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PRERENDER_PRERENDER_HISTOGRAMS_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 // currently underway (based on the PrerenderOrigin of the most recent | 33 // currently underway (based on the PrerenderOrigin of the most recent |
34 // prerenders, and any experiments detected). | 34 // prerenders, and any experiments detected). |
35 // PrerenderHistograms does not necessarily record all histograms related to | 35 // PrerenderHistograms does not necessarily record all histograms related to |
36 // prerendering, only the ones in the context of PrerenderManager. | 36 // prerendering, only the ones in the context of PrerenderManager. |
37 class PrerenderHistograms { | 37 class PrerenderHistograms { |
38 public: | 38 public: |
39 // Owned by a PrerenderManager object for the lifetime of the | 39 // Owned by a PrerenderManager object for the lifetime of the |
40 // PrerenderManager. | 40 // PrerenderManager. |
41 PrerenderHistograms(); | 41 PrerenderHistograms(); |
42 | 42 |
43 // Records the perceived page load time for a page - effectively the time from | |
44 // when the user navigates to a page to when it finishes loading. The actual | |
45 // load may have started prior to navigation due to prerender hints. | |
46 void RecordPerceivedPageLoadTime(Origin origin, | |
47 base::TimeDelta perceived_page_load_time, | |
48 NavigationType navigation_type, | |
49 const GURL& url); | |
50 | |
51 // Record that a first contentful paint occured, and whether we were able to | 43 // Record that a first contentful paint occured, and whether we were able to |
52 // successfuly record the perceived FCP. | 44 // successfuly record the perceived FCP. |
53 void RecordPerceivedFirstContentfulPaintStatus(Origin origin, | 45 void RecordPerceivedFirstContentfulPaintStatus(Origin origin, |
54 bool successful, | 46 bool successful, |
55 bool was_hidden); | 47 bool was_hidden); |
56 | 48 |
57 // Records, in a histogram, the percentage of the page load time that had | 49 // Records, in a histogram, the percentage of the page load time that had |
58 // elapsed by the time it is swapped in. Values outside of [0, 1.0] are | 50 // elapsed by the time it is swapped in. Values outside of [0, 1.0] are |
59 // invalid and ignored. | 51 // invalid and ignored. |
60 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const; | 52 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const; |
61 | 53 |
62 // Records the actual pageload time of a prerender that has not been swapped | |
63 // in yet, but finished loading. | |
64 void RecordPageLoadTimeNotSwappedIn(Origin origin, | |
65 base::TimeDelta page_load_time, | |
66 const GURL& url) const; | |
67 | |
68 // Records the time from when a page starts prerendering to when the user | 54 // Records the time from when a page starts prerendering to when the user |
69 // navigates to it. This must be called on the UI thread. | 55 // navigates to it. This must be called on the UI thread. |
70 void RecordTimeUntilUsed(Origin origin, | 56 void RecordTimeUntilUsed(Origin origin, |
71 base::TimeDelta time_until_used) const; | 57 base::TimeDelta time_until_used) const; |
72 | 58 |
73 // Records the time from when a prerender is abandoned to when the user | 59 // Records the time from when a prerender is abandoned to when the user |
74 // navigates to it. This must be called on the UI thread. | 60 // navigates to it. This must be called on the UI thread. |
75 void RecordAbandonTimeUntilUsed(Origin origin, | 61 void RecordAbandonTimeUntilUsed(Origin origin, |
76 base::TimeDelta time_until_used) const; | 62 base::TimeDelta time_until_used) const; |
77 | 63 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 140 |
155 // A boolean indicating that we have recently encountered a combination of | 141 // A boolean indicating that we have recently encountered a combination of |
156 // different origins, making an attribution of PPLT's to origins impossible. | 142 // different origins, making an attribution of PPLT's to origins impossible. |
157 bool origin_wash_; | 143 bool origin_wash_; |
158 | 144 |
159 // The time when we last saw a prerender request coming from a renderer. | 145 // The time when we last saw a prerender request coming from a renderer. |
160 // This is used to record perceived PLT's for a certain amount of time | 146 // This is used to record perceived PLT's for a certain amount of time |
161 // from the point that we last saw a <link rel=prerender> tag. | 147 // from the point that we last saw a <link rel=prerender> tag. |
162 base::TimeTicks last_prerender_seen_time_; | 148 base::TimeTicks last_prerender_seen_time_; |
163 | 149 |
164 // Indicates whether we have recorded page load events after the most | |
165 // recent prerender. These must be initialized to true, so that we don't | |
166 // start recording events before the first prerender occurs. | |
167 bool seen_any_pageload_; | |
168 bool seen_pageload_started_after_prerender_; | |
169 | |
170 base::ThreadChecker thread_checker_; | 150 base::ThreadChecker thread_checker_; |
171 | 151 |
172 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms); | 152 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms); |
173 }; | 153 }; |
174 | 154 |
175 } // namespace prerender | 155 } // namespace prerender |
176 | 156 |
177 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ | 157 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ |
OLD | NEW |