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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // |params->target_contents| if a prerendered page is swapped in, |false| | 178 // |params->target_contents| if a prerendered page is swapped in, |false| |
179 // otherwise. | 179 // otherwise. |
180 bool MaybeUsePrerenderedPage(const GURL& url, | 180 bool MaybeUsePrerenderedPage(const GURL& url, |
181 chrome::NavigateParams* params); | 181 chrome::NavigateParams* params); |
182 | 182 |
183 // Moves a PrerenderContents to the pending delete list from the list of | 183 // Moves a PrerenderContents to the pending delete list from the list of |
184 // active prerenders when prerendering should be cancelled. | 184 // active prerenders when prerendering should be cancelled. |
185 virtual void MoveEntryToPendingDelete(PrerenderContents* entry, | 185 virtual void MoveEntryToPendingDelete(PrerenderContents* entry, |
186 FinalStatus final_status); | 186 FinalStatus final_status); |
187 | 187 |
188 // Records the page load time for a prerender that wasn't swapped in. | |
189 void RecordPageLoadTimeNotSwappedIn(Origin origin, | |
190 base::TimeDelta page_load_time, | |
191 const GURL& url); | |
192 | |
193 // Records the perceived page load time for a page - effectively the time from | |
194 // when the user navigates to a page to when it finishes loading. The actual | |
195 // load may have started prior to navigation due to prerender hints. | |
196 // |fraction_plt_elapsed_at_swap_in| must either be in [0.0, 1.0], or a value | |
197 // outside that range indicating that it doesn't apply. | |
198 void RecordPerceivedPageLoadTime( | |
199 Origin origin, | |
200 NavigationType navigation_type, | |
201 base::TimeDelta perceived_page_load_time, | |
202 double fraction_plt_elapsed_at_swap_in, | |
203 const GURL& url); | |
204 | |
205 // Called when a NoStatePrefetch request has received a response (including | 188 // Called when a NoStatePrefetch request has received a response (including |
206 // redirects). May be called several times per resource, in case of redirects. | 189 // redirects). May be called several times per resource, in case of redirects. |
207 void RecordPrefetchResponseReceived(Origin origin, | 190 void RecordPrefetchResponseReceived(Origin origin, |
208 bool is_main_resource, | 191 bool is_main_resource, |
209 bool is_redirect, | 192 bool is_redirect, |
210 bool is_no_store); | 193 bool is_no_store); |
211 | 194 |
212 // Called when a NoStatePrefetch resource has been loaded. This is called only | 195 // Called when a NoStatePrefetch resource has been loaded. This is called only |
213 // once per resource, when all redirects have been resolved. | 196 // once per resource, when all redirects have been resolved. |
214 void RecordPrefetchRedirectCount(Origin origin, | 197 void RecordPrefetchRedirectCount(Origin origin, |
215 bool is_main_resource, | 198 bool is_main_resource, |
216 int redirect_count); | 199 int redirect_count); |
217 | 200 |
218 // Called when a NoStatePrefetch first contentful paint has fired. | 201 // Called when a NoStatePrefetch first contentful paint has fired. |
219 void RecordPrefetchFirstContentfulPaint(Origin origin, | 202 void RecordPrefetchFirstContentfulPaint(Origin origin, |
220 bool is_no_store, | 203 bool is_no_store, |
221 bool was_hidden, | 204 bool was_hidden, |
222 base::TimeDelta time, | 205 base::TimeDelta time, |
223 base::TimeDelta prefetch_age); | 206 base::TimeDelta prefetch_age); |
224 | 207 |
225 // Records the time to first contentful paint for loads that previously had a | 208 // Records the time to first contentful paint for loads that previously had a |
226 // no state prefetch load. Must not be called for prefetch loads themselves | 209 // no state prefetch load. Must not be called for prefetch loads themselves |
227 // (which are never rendered anyway). |is_no_store| must be true if the main | 210 // (which are never rendered anyway). |is_no_store| must be true if the main |
228 // resource has a "no-store" cache control HTTP header. | 211 // resource has a "no-store" cache control HTTP header. |
229 void RecordNoStateFirstContentfulPaint(const GURL& url, | 212 void RecordNoStateFirstContentfulPaint(const GURL& url, |
230 bool is_no_store, | 213 bool is_no_store, |
231 bool was_hidden, | 214 bool was_hidden, |
232 base::TimeDelta time); | 215 base::TimeDelta time); |
233 | 216 |
234 // Records the perceived first contentful paint time for a prerendered page, | 217 // Records the perceived first contentful paint time for a prerendered page. |
235 // analogous to |RecordPerceivedPageLoadTime|. The FCP ticks is in absolute | 218 // The actual load may have started prior to navigation due to prerender |
236 // time; this has the disadvantage that the histogram will mix browser and | 219 // hints. The FCP ticks is in absolute time; this has the disadvantage that |
237 // renderer ticks, but there seems to be no way around that. | 220 // the histogram will mix browser and renderer ticks, but there seems to be no |
| 221 // way around that. |
238 void RecordPrerenderFirstContentfulPaint(const GURL& url, | 222 void RecordPrerenderFirstContentfulPaint(const GURL& url, |
239 content::WebContents* web_contents, | 223 content::WebContents* web_contents, |
240 bool is_no_store, | 224 bool is_no_store, |
241 bool was_hidden, | 225 bool was_hidden, |
242 base::TimeTicks ticks); | 226 base::TimeTicks ticks); |
243 | 227 |
244 static PrerenderManagerMode GetMode(); | 228 static PrerenderManagerMode GetMode(); |
245 static void SetMode(PrerenderManagerMode mode); | 229 static void SetMode(PrerenderManagerMode mode); |
246 static bool IsPrerenderingPossible(); | 230 static bool IsPrerenderingPossible(); |
247 static bool IsNoStatePrefetch(Origin origin); | 231 static bool IsNoStatePrefetch(Origin origin); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 std::vector<std::unique_ptr<PrerenderManagerObserver>> observers_; | 633 std::vector<std::unique_ptr<PrerenderManagerObserver>> observers_; |
650 | 634 |
651 base::WeakPtrFactory<PrerenderManager> weak_factory_; | 635 base::WeakPtrFactory<PrerenderManager> weak_factory_; |
652 | 636 |
653 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 637 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
654 }; | 638 }; |
655 | 639 |
656 } // namespace prerender | 640 } // namespace prerender |
657 | 641 |
658 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 642 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |