| 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 perceived first contentful paint time for prerendered pages, the |
| 56 // time from when the user navigates to a page to when it finishes loading. |
| 57 // The actual load may have started prior to navigation due to prerender |
| 58 // hints. |
| 59 void RecordPerceivedFirstContentfulPaintTime( |
| 60 Origin origin, |
| 61 base::TimeDelta perceived_first_contentful_paint); |
| 62 |
| 63 // Record that a first contentful paint occured, and whether we were able to |
| 64 // successfuly record the perceived FCP. |
| 65 void RecordPerceivedFirstContentfulPaintStatus(Origin origin, |
| 66 bool successful); |
| 67 |
| 55 // Records, in a histogram, the percentage of the page load time that had | 68 // 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 | 69 // elapsed by the time it is swapped in. Values outside of [0, 1.0] are |
| 57 // invalid and ignored. | 70 // invalid and ignored. |
| 58 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const; | 71 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const; |
| 59 | 72 |
| 60 // Records the actual pageload time of a prerender that has not been swapped | 73 // Records the actual pageload time of a prerender that has not been swapped |
| 61 // in yet, but finished loading. | 74 // in yet, but finished loading. |
| 62 void RecordPageLoadTimeNotSwappedIn(Origin origin, | 75 void RecordPageLoadTimeNotSwappedIn(Origin origin, |
| 63 base::TimeDelta page_load_time, | 76 base::TimeDelta page_load_time, |
| 64 const GURL& url) const; | 77 const GURL& url) const; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 bool is_main_resource, | 127 bool is_main_resource, |
| 115 bool is_redirect, | 128 bool is_redirect, |
| 116 bool is_no_store) const; | 129 bool is_no_store) const; |
| 117 | 130 |
| 118 // Called when a NoStatePrefetch resource has been loaded. This is called only | 131 // Called when a NoStatePrefetch resource has been loaded. This is called only |
| 119 // once per resource, when all redirects have been resolved. | 132 // once per resource, when all redirects have been resolved. |
| 120 void RecordPrefetchRedirectCount(Origin origin, | 133 void RecordPrefetchRedirectCount(Origin origin, |
| 121 bool is_main_resource, | 134 bool is_main_resource, |
| 122 int redirect_count) const; | 135 int redirect_count) const; |
| 123 | 136 |
| 124 // Records the time to first contentful paint. | 137 // Records the time to first contentful paint in the context of NoState |
| 125 // Must not be called for prefetch loads (which are never rendered anyway). | 138 // Prefetch. |
| 139 |
| 140 // Must be called for an actual page load, and not be called for prefetch |
| 141 // loads (which are never rendered anyway). |
| 126 // |is_no_store| must be true if the main resource has a "no-store" cache | 142 // |is_no_store| must be true if the main resource has a "no-store" cache |
| 127 // control HTTP header. | 143 // control HTTP header. |
| 128 // |prefetch_age| must be zero if the page was not prefetched. | 144 // |prefetch_age| must be zero if the page was not prefetched. |
| 129 void RecordFirstContentfulPaint(Origin origin, | 145 void RecordNoStateFirstContentfulPaint(Origin origin, |
| 130 bool is_no_store, | 146 bool is_no_store, |
| 131 base::TimeDelta time, | 147 base::TimeDelta time, |
| 132 base::TimeDelta prefetch_age); | 148 base::TimeDelta prefetch_age); |
| 133 | 149 |
| 134 // Returns the name of the histogram used to record the time to first | 150 // Returns the name of the histogram used to record the time to first |
| 135 // contentful paint. | 151 // contentful paint for NoState Prefetch. |
| 136 // Exposed for testing. | 152 // Exposed for testing. |
| 137 static std::string GetFirstContentfulPaintHistogramName( | 153 static std::string GetNoStateFirstContentfulPaintHistogramName( |
| 138 Origin origin, | 154 Origin origin, |
| 139 bool is_wash, | 155 bool is_wash, |
| 140 bool is_no_store, | 156 bool is_no_store, |
| 141 base::TimeDelta prefetch_age); | 157 base::TimeDelta prefetch_age); |
| 142 | 158 |
| 143 private: | 159 private: |
| 160 // Returns the name of the histogram used to record the time to first |
| 161 // contentful paint for Prerender. |
| 162 std::string GetPerceivedFirstContentfulPaintHistogramName(Origin origin, |
| 163 bool is_wash); |
| 164 |
| 144 base::TimeTicks GetCurrentTimeTicks() const; | 165 base::TimeTicks GetCurrentTimeTicks() const; |
| 145 | 166 |
| 146 // Returns the time elapsed since the last prerender happened. | 167 // Returns the time elapsed since the last prerender happened. |
| 147 base::TimeDelta GetTimeSinceLastPrerender() const; | 168 base::TimeDelta GetTimeSinceLastPrerender() const; |
| 148 | 169 |
| 149 // Returns whether the PrerenderManager is currently within the prerender | 170 // Returns whether the PrerenderManager is currently within the prerender |
| 150 // window - effectively, up to 30 seconds after a prerender tag has been | 171 // window - effectively, up to 30 seconds after a prerender tag has been |
| 151 // observed. | 172 // observed. |
| 152 bool WithinWindow() const; | 173 bool WithinWindow() const; |
| 153 | 174 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 173 bool seen_pageload_started_after_prerender_; | 194 bool seen_pageload_started_after_prerender_; |
| 174 | 195 |
| 175 base::ThreadChecker thread_checker_; | 196 base::ThreadChecker thread_checker_; |
| 176 | 197 |
| 177 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms); | 198 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms); |
| 178 }; | 199 }; |
| 179 | 200 |
| 180 } // namespace prerender | 201 } // namespace prerender |
| 181 | 202 |
| 182 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ | 203 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ |
| OLD | NEW |