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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // This must be called on the UI thread. | 187 // This must be called on the UI thread. |
188 // |fraction_plt_elapsed_at_swap_in| must either be in [0.0, 1.0], or a value | 188 // |fraction_plt_elapsed_at_swap_in| must either be in [0.0, 1.0], or a value |
189 // outside that range indicating that it doesn't apply. | 189 // outside that range indicating that it doesn't apply. |
190 void RecordPerceivedPageLoadTime( | 190 void RecordPerceivedPageLoadTime( |
191 Origin origin, | 191 Origin origin, |
192 NavigationType navigation_type, | 192 NavigationType navigation_type, |
193 base::TimeDelta perceived_page_load_time, | 193 base::TimeDelta perceived_page_load_time, |
194 double fraction_plt_elapsed_at_swap_in, | 194 double fraction_plt_elapsed_at_swap_in, |
195 const GURL& url); | 195 const GURL& url); |
196 | 196 |
197 // Set whether prerendering is currently enabled for this manager. | |
198 // Must be called on the UI thread. | |
199 // If |enabled| is false, existing prerendered pages will still persist until | |
200 // they time out, but new ones will not be generated. | |
201 void set_enabled(bool enabled); | |
202 | |
203 static PrerenderManagerMode GetMode(); | 197 static PrerenderManagerMode GetMode(); |
204 static void SetMode(PrerenderManagerMode mode); | 198 static void SetMode(PrerenderManagerMode mode); |
205 static const char* GetModeString(); | 199 static const char* GetModeString(); |
206 static bool IsPrerenderingPossible(); | 200 static bool IsPrerenderingPossible(); |
207 static bool ActuallyPrerendering(); | 201 static bool ActuallyPrerendering(); |
208 static bool IsControlGroup(uint8 experiment_id); | 202 static bool IsControlGroup(uint8 experiment_id); |
209 static bool IsNoUseGroup(); | 203 static bool IsNoUseGroup(); |
210 | 204 |
211 // Query the list of current prerender pages to see if the given web contents | 205 // Query the list of current prerender pages to see if the given web contents |
212 // is prerendering a page. The optional parameter |origin| is an output | 206 // is prerendering a page. The optional parameter |origin| is an output |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 // if a swap-in was not possible. If |should_replace_current_entry| is true, | 664 // if a swap-in was not possible. If |should_replace_current_entry| is true, |
671 // the current history entry in |web_contents| is replaced. | 665 // the current history entry in |web_contents| is replaced. |
672 content::WebContents* SwapInternal(const GURL& url, | 666 content::WebContents* SwapInternal(const GURL& url, |
673 content::WebContents* web_contents, | 667 content::WebContents* web_contents, |
674 PrerenderData* prerender_data, | 668 PrerenderData* prerender_data, |
675 bool should_replace_current_entry); | 669 bool should_replace_current_entry); |
676 | 670 |
677 // The configuration. | 671 // The configuration. |
678 Config config_; | 672 Config config_; |
679 | 673 |
680 // Specifies whether prerendering is currently enabled for this | |
681 // manager. The value can change dynamically during the lifetime | |
682 // of the PrerenderManager. | |
683 bool enabled_; | |
684 | |
685 // The profile that owns this PrerenderManager. | 674 // The profile that owns this PrerenderManager. |
686 Profile* profile_; | 675 Profile* profile_; |
687 | 676 |
688 PrerenderTracker* prerender_tracker_; | 677 PrerenderTracker* prerender_tracker_; |
689 | 678 |
690 // All running prerenders. Sorted by expiry time, in ascending order. | 679 // All running prerenders. Sorted by expiry time, in ascending order. |
691 ScopedVector<PrerenderData> active_prerenders_; | 680 ScopedVector<PrerenderData> active_prerenders_; |
692 | 681 |
693 // Prerenders awaiting deletion. | 682 // Prerenders awaiting deletion. |
694 ScopedVector<PrerenderData> to_delete_prerenders_; | 683 ScopedVector<PrerenderData> to_delete_prerenders_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 bool cookie_store_loaded_; | 742 bool cookie_store_loaded_; |
754 | 743 |
755 base::Closure on_cookie_store_loaded_cb_for_testing_; | 744 base::Closure on_cookie_store_loaded_cb_for_testing_; |
756 | 745 |
757 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 746 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
758 }; | 747 }; |
759 | 748 |
760 } // namespace prerender | 749 } // namespace prerender |
761 | 750 |
762 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 751 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |