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. | |
219 void RecordPrefetchFirstContentfulPaint(Origin origin, | |
220 bool is_no_store, | |
221 bool was_hidden, | |
222 base::TimeDelta time, | |
223 base::TimeDelta prefetch_age); | |
224 | |
225 // Records the time to first contentful paint for loads that previously had a | 201 // 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 | 202 // 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 | 203 // (which are never rendered anyway). |is_no_store| must be true if the main |
228 // resource has a "no-store" cache control HTTP header. | 204 // resource has a "no-store" cache control HTTP header. |
229 void RecordNoStateFirstContentfulPaint(const GURL& url, | 205 void RecordNoStateFirstContentfulPaint(const GURL& url, |
230 bool is_no_store, | 206 bool is_no_store, |
231 bool was_hidden, | 207 bool was_hidden, |
232 base::TimeDelta time); | 208 base::TimeDelta time); |
233 | 209 |
234 // Records the perceived first contentful paint time for a prerendered page, | 210 // Records the perceived first contentful paint time for a prerendered page. |
235 // analogous to |RecordPerceivedPageLoadTime|. The FCP ticks is in absolute | 211 // 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 | 212 // 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. | 213 // the histogram will mix browser and renderer ticks, but there seems to be no |
| 214 // way around that. |
238 void RecordPrerenderFirstContentfulPaint(const GURL& url, | 215 void RecordPrerenderFirstContentfulPaint(const GURL& url, |
239 content::WebContents* web_contents, | 216 content::WebContents* web_contents, |
240 bool is_no_store, | 217 bool is_no_store, |
241 bool was_hidden, | 218 bool was_hidden, |
242 base::TimeTicks ticks); | 219 base::TimeTicks ticks); |
243 | 220 |
244 static PrerenderManagerMode GetMode(Origin origin); | 221 static PrerenderManagerMode GetMode(Origin origin); |
245 static void SetMode(PrerenderManagerMode mode); | 222 static void SetMode(PrerenderManagerMode mode); |
246 static void SetOmniboxMode(PrerenderManagerMode mode); | 223 static void SetOmniboxMode(PrerenderManagerMode mode); |
247 static void SetInstantMode(PrerenderManagerMode mode); | 224 static void SetInstantMode(PrerenderManagerMode mode); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 std::vector<std::unique_ptr<PrerenderManagerObserver>> observers_; | 630 std::vector<std::unique_ptr<PrerenderManagerObserver>> observers_; |
654 | 631 |
655 base::WeakPtrFactory<PrerenderManager> weak_factory_; | 632 base::WeakPtrFactory<PrerenderManager> weak_factory_; |
656 | 633 |
657 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 634 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
658 }; | 635 }; |
659 | 636 |
660 } // namespace prerender | 637 } // namespace prerender |
661 | 638 |
662 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 639 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |