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