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