| 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 30 matching lines...) Expand all Loading... |
| 41 const GURL& validated_url, | 41 const GURL& validated_url, |
| 42 ui::PageTransition transition_type) override; | 42 ui::PageTransition transition_type) override; |
| 43 | 43 |
| 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 base::TimeTicks swap_ticks() const { return swap_ticks_; } |
| 52 |
| 53 Origin origin() const { return origin_; } |
| 54 |
| 51 private: | 55 private: |
| 52 explicit PrerenderTabHelper(content::WebContents* web_contents); | 56 explicit PrerenderTabHelper(content::WebContents* web_contents); |
| 53 friend class content::WebContentsUserData<PrerenderTabHelper>; | 57 friend class content::WebContentsUserData<PrerenderTabHelper>; |
| 54 | 58 |
| 55 void RecordPerceivedPageLoadTime( | 59 void RecordPerceivedPageLoadTime( |
| 56 base::TimeDelta perceived_page_load_time, | 60 base::TimeDelta perceived_page_load_time, |
| 57 double fraction_plt_elapsed_at_swap_in); | 61 double fraction_plt_elapsed_at_swap_in); |
| 58 | 62 |
| 59 // Retrieves the PrerenderManager, or NULL, if none was found. | 63 // Retrieves the PrerenderManager, or NULL, if none was found. |
| 60 PrerenderManager* MaybeGetPrerenderManager() const; | 64 PrerenderManager* MaybeGetPrerenderManager() const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 79 // System time at which the current load was started for the purpose of | 83 // System time at which the current load was started for the purpose of |
| 80 // the perceived page load time (PPLT). If null, there is no current | 84 // the perceived page load time (PPLT). If null, there is no current |
| 81 // load. | 85 // load. |
| 82 base::TimeTicks pplt_load_start_; | 86 base::TimeTicks pplt_load_start_; |
| 83 | 87 |
| 84 // System time at which the actual pageload started (pre-swapin), if | 88 // System time at which the actual pageload started (pre-swapin), if |
| 85 // a applicable (in cases when a prerender that was still loading was | 89 // a applicable (in cases when a prerender that was still loading was |
| 86 // swapped in). | 90 // swapped in). |
| 87 base::TimeTicks actual_load_start_; | 91 base::TimeTicks actual_load_start_; |
| 88 | 92 |
| 93 // Record the most recent swap time. This differs from |pplt_load_start_| in |
| 94 // that it is not reset in various circumstances, like a load being stopped. |
| 95 base::TimeTicks swap_ticks_; |
| 96 |
| 89 // Current URL being loaded. | 97 // Current URL being loaded. |
| 90 GURL url_; | 98 GURL url_; |
| 91 | 99 |
| 92 base::WeakPtrFactory<PrerenderTabHelper> weak_factory_; | 100 base::WeakPtrFactory<PrerenderTabHelper> weak_factory_; |
| 93 | 101 |
| 94 DISALLOW_COPY_AND_ASSIGN(PrerenderTabHelper); | 102 DISALLOW_COPY_AND_ASSIGN(PrerenderTabHelper); |
| 95 }; | 103 }; |
| 96 | 104 |
| 97 } // namespace prerender | 105 } // namespace prerender |
| 98 | 106 |
| 99 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ | 107 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
| OLD | NEW |