| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Destroy all preloads for the given child route id pair and assign a final | 93 // Destroy all preloads for the given child route id pair and assign a final |
| 94 // status to them. | 94 // status to them. |
| 95 void DestroyPreloadForChildRouteIdPair( | 95 void DestroyPreloadForChildRouteIdPair( |
| 96 const std::pair<int, int>& child_route_id_pair, | 96 const std::pair<int, int>& child_route_id_pair, |
| 97 FinalStatus final_status); | 97 FinalStatus final_status); |
| 98 | 98 |
| 99 // For a given TabContents that wants to navigate to the URL supplied, | 99 // For a given TabContents that wants to navigate to the URL supplied, |
| 100 // determines whether a preloaded version of the URL can be used, | 100 // determines whether a preloaded version of the URL can be used, |
| 101 // and substitutes the prerendered RVH into the TabContents. Returns | 101 // and substitutes the prerendered RVH into the TabContents. Returns |
| 102 // whether or not a prerendered RVH could be used or not. | 102 // whether or not a prerendered RVH could be used or not. |
| 103 bool MaybeUsePreloadedPage(TabContents* tab_contents, const GURL& url); | 103 bool MaybeUsePreloadedPage(TabContents* tab_contents, |
| 104 bool MaybeUsePreloadedPageOld(TabContents* tab_contents, const GURL& url); | 104 const GURL& url, |
| 105 bool has_opener_set); |
| 106 bool MaybeUsePreloadedPageOld(TabContents* tab_contents, |
| 107 const GURL& url, |
| 108 bool has_opener_set); |
| 105 | 109 |
| 106 // Moves a PrerenderContents to the pending delete list from the list of | 110 // Moves a PrerenderContents to the pending delete list from the list of |
| 107 // active prerenders when prerendering should be cancelled. | 111 // active prerenders when prerendering should be cancelled. |
| 108 void MoveEntryToPendingDelete(PrerenderContents* entry); | 112 void MoveEntryToPendingDelete(PrerenderContents* entry); |
| 109 | 113 |
| 110 // Checks if the PrerenderContents has been added to the pending delete list. | 114 // Checks if the PrerenderContents has been added to the pending delete list. |
| 111 bool IsPendingDelete(PrerenderContents* entry) const; | 115 bool IsPendingDelete(PrerenderContents* entry) const; |
| 112 | 116 |
| 113 // Retrieves the PrerenderContents object for the specified URL, if it | 117 // Retrieves the PrerenderContents object for the specified URL, if it |
| 114 // has been prerendered. The caller will then have ownership of the | 118 // has been prerendered. The caller will then have ownership of the |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 base::TimeDelta max_prerender_age_; | 261 base::TimeDelta max_prerender_age_; |
| 258 // Maximum amount of memory, in megabytes, that a single PrerenderContents | 262 // Maximum amount of memory, in megabytes, that a single PrerenderContents |
| 259 // can use before it's cancelled. | 263 // can use before it's cancelled. |
| 260 size_t max_prerender_memory_mb_; | 264 size_t max_prerender_memory_mb_; |
| 261 unsigned int max_elements_; | 265 unsigned int max_elements_; |
| 262 | 266 |
| 263 // List of prerendered elements. | 267 // List of prerendered elements. |
| 264 std::list<PrerenderContentsData> prerender_list_; | 268 std::list<PrerenderContentsData> prerender_list_; |
| 265 | 269 |
| 266 // List of prerender elements to be deleted | 270 // List of prerender elements to be deleted |
| 267 std::list<PrerenderContentsData> pending_delete_list_; | 271 std::list<PrerenderContents*> pending_delete_list_; |
| 268 | 272 |
| 269 // Set of TabContents which are currently displaying a prerendered page. | 273 // Set of TabContents which are currently displaying a prerendered page. |
| 270 base::hash_set<TabContents*> prerendered_tab_contents_set_; | 274 base::hash_set<TabContents*> prerendered_tab_contents_set_; |
| 271 | 275 |
| 272 // Set of TabContents which would be displaying a prerendered page | 276 // Set of TabContents which would be displaying a prerendered page |
| 273 // (for the control group). | 277 // (for the control group). |
| 274 base::hash_set<TabContents*> would_be_prerendered_tab_contents_set_; | 278 base::hash_set<TabContents*> would_be_prerendered_tab_contents_set_; |
| 275 | 279 |
| 276 // Map of child/route id pairs to pending prerender data. | 280 // Map of child/route id pairs to pending prerender data. |
| 277 typedef std::map<std::pair<int, int>, std::vector<PendingContentsData> > | 281 typedef std::map<std::pair<int, int>, std::vector<PendingContentsData> > |
| (...skipping 21 matching lines...) Expand all Loading... |
| 299 base::TimeTicks last_prerender_start_time_; | 303 base::TimeTicks last_prerender_start_time_; |
| 300 | 304 |
| 301 std::list<TabContentsWrapper*> old_tab_contents_list_; | 305 std::list<TabContentsWrapper*> old_tab_contents_list_; |
| 302 | 306 |
| 303 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 307 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 304 }; | 308 }; |
| 305 | 309 |
| 306 } // namespace prerender | 310 } // namespace prerender |
| 307 | 311 |
| 308 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 312 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |