| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 PrerenderHistograms(); | 45 PrerenderHistograms(); |
| 46 | 46 |
| 47 // Records the perceived page load time for a page - effectively the time from | 47 // Records the perceived page load time for a page - effectively the time from |
| 48 // when the user navigates to a page to when it finishes loading. The actual | 48 // when the user navigates to a page to when it finishes loading. The actual |
| 49 // load may have started prior to navigation due to prerender hints. | 49 // load may have started prior to navigation due to prerender hints. |
| 50 void RecordPerceivedPageLoadTime(Origin origin, | 50 void RecordPerceivedPageLoadTime(Origin origin, |
| 51 base::TimeDelta perceived_page_load_time, | 51 base::TimeDelta perceived_page_load_time, |
| 52 NavigationType navigation_type, | 52 NavigationType navigation_type, |
| 53 const GURL& url); | 53 const GURL& url); |
| 54 | 54 |
| 55 // Record that a first contentful paint occured, and whether we were able to |
| 56 // successfuly record the perceived FCP. |
| 57 void RecordPerceivedFirstContentfulPaintStatus(Origin origin, |
| 58 bool successful, |
| 59 bool was_hidden); |
| 60 |
| 55 // Records, in a histogram, the percentage of the page load time that had | 61 // Records, in a histogram, the percentage of the page load time that had |
| 56 // elapsed by the time it is swapped in. Values outside of [0, 1.0] are | 62 // elapsed by the time it is swapped in. Values outside of [0, 1.0] are |
| 57 // invalid and ignored. | 63 // invalid and ignored. |
| 58 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const; | 64 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const; |
| 59 | 65 |
| 60 // Records the actual pageload time of a prerender that has not been swapped | 66 // Records the actual pageload time of a prerender that has not been swapped |
| 61 // in yet, but finished loading. | 67 // in yet, but finished loading. |
| 62 void RecordPageLoadTimeNotSwappedIn(Origin origin, | 68 void RecordPageLoadTimeNotSwappedIn(Origin origin, |
| 63 base::TimeDelta page_load_time, | 69 base::TimeDelta page_load_time, |
| 64 const GURL& url) const; | 70 const GURL& url) const; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 bool is_main_resource, | 120 bool is_main_resource, |
| 115 bool is_redirect, | 121 bool is_redirect, |
| 116 bool is_no_store) const; | 122 bool is_no_store) const; |
| 117 | 123 |
| 118 // Called when a NoStatePrefetch resource has been loaded. This is called only | 124 // Called when a NoStatePrefetch resource has been loaded. This is called only |
| 119 // once per resource, when all redirects have been resolved. | 125 // once per resource, when all redirects have been resolved. |
| 120 void RecordPrefetchRedirectCount(Origin origin, | 126 void RecordPrefetchRedirectCount(Origin origin, |
| 121 bool is_main_resource, | 127 bool is_main_resource, |
| 122 int redirect_count) const; | 128 int redirect_count) const; |
| 123 | 129 |
| 124 // Records the time to first contentful paint. | 130 // Records the time to first contentful paint with respect to a possible |
| 125 // Must not be called for prefetch loads (which are never rendered anyway). | 131 // prefetch of the page. The time to first contentful paint with respect to |
| 126 // |is_no_store| must be true if the main resource has a "no-store" cache | 132 // the navigation start is recorded (even if the page was prererendered in |
| 127 // control HTTP header. | 133 // advance of navigation start). One of several histograms is used, depending |
| 128 // |prefetch_age| must be zero if the page was not prefetched. | 134 // on whether this URL could have been prefetched before the navigation |
| 129 void RecordFirstContentfulPaint(Origin origin, | 135 // leading to the paint. |
| 130 bool is_no_store, | 136 void RecordPrefetchFirstContentfulPaintTime(Origin origin, |
| 131 base::TimeDelta time, | 137 bool is_no_store, |
| 132 base::TimeDelta prefetch_age); | 138 bool was_hidden, |
| 133 | 139 base::TimeDelta time, |
| 134 // Returns the name of the histogram used to record the time to first | 140 base::TimeDelta prefetch_age); |
| 135 // contentful paint. | |
| 136 // Exposed for testing. | |
| 137 static std::string GetFirstContentfulPaintHistogramName( | |
| 138 Origin origin, | |
| 139 bool is_wash, | |
| 140 bool is_no_store, | |
| 141 base::TimeDelta prefetch_age); | |
| 142 | 141 |
| 143 private: | 142 private: |
| 143 // The suffix used for first contentful paint visibility. |
| 144 static std::string FirstContentfulPaintHiddenName(bool was_hidden); |
| 145 |
| 144 base::TimeTicks GetCurrentTimeTicks() const; | 146 base::TimeTicks GetCurrentTimeTicks() const; |
| 145 | 147 |
| 146 // Returns the time elapsed since the last prerender happened. | 148 // Returns the time elapsed since the last prerender happened. |
| 147 base::TimeDelta GetTimeSinceLastPrerender() const; | 149 base::TimeDelta GetTimeSinceLastPrerender() const; |
| 148 | 150 |
| 149 // Returns whether the PrerenderManager is currently within the prerender | 151 // Returns whether the PrerenderManager is currently within the prerender |
| 150 // window - effectively, up to 30 seconds after a prerender tag has been | 152 // window - effectively, up to 30 seconds after a prerender tag has been |
| 151 // observed. | 153 // observed. |
| 152 bool WithinWindow() const; | 154 bool WithinWindow() const; |
| 153 | 155 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 173 bool seen_pageload_started_after_prerender_; | 175 bool seen_pageload_started_after_prerender_; |
| 174 | 176 |
| 175 base::ThreadChecker thread_checker_; | 177 base::ThreadChecker thread_checker_; |
| 176 | 178 |
| 177 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms); | 179 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms); |
| 178 }; | 180 }; |
| 179 | 181 |
| 180 } // namespace prerender | 182 } // namespace prerender |
| 181 | 183 |
| 182 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ | 184 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ |
| OLD | NEW |