| 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_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // Called when the URL of the main frame changed, either when the load | 44 // Called when the URL of the main frame changed, either when the load |
| 45 // commits, or a redirect happens. | 45 // commits, or a redirect happens. |
| 46 void MainFrameUrlDidChange(const GURL& url); | 46 void MainFrameUrlDidChange(const GURL& url); |
| 47 | 47 |
| 48 // Called when this prerendered WebContents has just been swapped in. | 48 // Called when this prerendered WebContents has just been swapped in. |
| 49 void PrerenderSwappedIn(); | 49 void PrerenderSwappedIn(); |
| 50 | 50 |
| 51 // Called when a control prerender is resolved. Applies to the next load. | 51 // Called when a control prerender is resolved. Applies to the next load. |
| 52 void WouldHavePrerenderedNextLoad(Origin origin); | 52 void WouldHavePrerenderedNextLoad(Origin origin); |
| 53 | 53 |
| 54 base::TimeTicks swap_ticks() const { return swap_ticks_; } |
| 55 |
| 56 Origin origin() const { return origin_; } |
| 57 |
| 54 private: | 58 private: |
| 55 explicit PrerenderTabHelper(content::WebContents* web_contents); | 59 explicit PrerenderTabHelper(content::WebContents* web_contents); |
| 56 friend class content::WebContentsUserData<PrerenderTabHelper>; | 60 friend class content::WebContentsUserData<PrerenderTabHelper>; |
| 57 | 61 |
| 58 void RecordPerceivedPageLoadTime( | 62 void RecordPerceivedPageLoadTime( |
| 59 base::TimeDelta perceived_page_load_time, | 63 base::TimeDelta perceived_page_load_time, |
| 60 double fraction_plt_elapsed_at_swap_in); | 64 double fraction_plt_elapsed_at_swap_in); |
| 61 | 65 |
| 62 // Retrieves the PrerenderManager, or NULL, if none was found. | 66 // Retrieves the PrerenderManager, or NULL, if none was found. |
| 63 PrerenderManager* MaybeGetPrerenderManager() const; | 67 PrerenderManager* MaybeGetPrerenderManager() const; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 89 // System time at which the current load was started for the purpose of | 93 // System time at which the current load was started for the purpose of |
| 90 // the perceived page load time (PPLT). If null, there is no current | 94 // the perceived page load time (PPLT). If null, there is no current |
| 91 // load. | 95 // load. |
| 92 base::TimeTicks pplt_load_start_; | 96 base::TimeTicks pplt_load_start_; |
| 93 | 97 |
| 94 // System time at which the actual pageload started (pre-swapin), if | 98 // System time at which the actual pageload started (pre-swapin), if |
| 95 // a applicable (in cases when a prerender that was still loading was | 99 // a applicable (in cases when a prerender that was still loading was |
| 96 // swapped in). | 100 // swapped in). |
| 97 base::TimeTicks actual_load_start_; | 101 base::TimeTicks actual_load_start_; |
| 98 | 102 |
| 103 // Record the most recent swap time. This differs from |pplt_load_start_| in |
| 104 // that it is not reset in various circumstances, like a load being stopped. |
| 105 base::TimeTicks swap_ticks_; |
| 106 |
| 99 // Current URL being loaded. | 107 // Current URL being loaded. |
| 100 GURL url_; | 108 GURL url_; |
| 101 | 109 |
| 102 base::WeakPtrFactory<PrerenderTabHelper> weak_factory_; | 110 base::WeakPtrFactory<PrerenderTabHelper> weak_factory_; |
| 103 | 111 |
| 104 DISALLOW_COPY_AND_ASSIGN(PrerenderTabHelper); | 112 DISALLOW_COPY_AND_ASSIGN(PrerenderTabHelper); |
| 105 }; | 113 }; |
| 106 | 114 |
| 107 } // namespace prerender | 115 } // namespace prerender |
| 108 | 116 |
| 109 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ | 117 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
| OLD | NEW |