Chromium Code Reviews| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 | 144 |
| 145 // Adds a prerender for Instant Search |url| if valid. The | 145 // Adds a prerender for Instant Search |url| if valid. The |
| 146 // |session_storage_namespace| matches the namespace of the active tab at the | 146 // |session_storage_namespace| matches the namespace of the active tab at the |
| 147 // time the prerender is generated. Returns a caller-owned PrerenderHandle* or | 147 // time the prerender is generated. Returns a caller-owned PrerenderHandle* or |
| 148 // NULL. | 148 // NULL. |
| 149 PrerenderHandle* AddPrerenderForInstant( | 149 PrerenderHandle* AddPrerenderForInstant( |
| 150 const GURL& url, | 150 const GURL& url, |
| 151 content::SessionStorageNamespace* session_storage_namespace, | 151 content::SessionStorageNamespace* session_storage_namespace, |
| 152 const gfx::Size& size); | 152 const gfx::Size& size); |
| 153 | 153 |
| 154 // Adds a prerender for the background loader. Returns a caller-owned | |
| 155 // PrerenderHandle* if the URL was added, NULL if it was not. | |
| 156 // | |
| 157 // The caller may set an observer on the handle to receive load events. When | |
| 158 // the caller is done using the WebContents, it should call OnCancel() on the | |
| 159 // handle to free the resources associated with the prerender. | |
| 160 // | |
| 161 // The caller must provide two guarantees: | |
| 162 // 1. It must never ask to as for a swap-in; | |
|
mmenke
2016/04/22 16:41:33
-"to as"
gabadie
2016/04/25 11:08:24
Done.
| |
| 163 // 2. The SessionStorageNamespace must not be shared with any tab / page load | |
| 164 // to avoid swapping in from there. | |
| 165 PrerenderHandle* AddPrerenderForOffline( | |
| 166 const GURL& url, | |
| 167 content::SessionStorageNamespace* session_storage_namespace, | |
| 168 const gfx::Size& size); | |
| 169 | |
| 154 // Cancels all active prerenders. | 170 // Cancels all active prerenders. |
| 155 void CancelAllPrerenders(); | 171 void CancelAllPrerenders(); |
| 156 | 172 |
| 157 // If |url| matches a valid prerendered page and |params| are compatible, try | 173 // If |url| matches a valid prerendered page and |params| are compatible, try |
| 158 // to swap it and merge browsing histories. Returns |true| and updates | 174 // to swap it and merge browsing histories. Returns |true| and updates |
| 159 // |params->target_contents| if a prerendered page is swapped in, |false| | 175 // |params->target_contents| if a prerendered page is swapped in, |false| |
| 160 // otherwise. | 176 // otherwise. |
| 161 bool MaybeUsePrerenderedPage(const GURL& url, | 177 bool MaybeUsePrerenderedPage(const GURL& url, |
| 162 chrome::NavigateParams* params); | 178 chrome::NavigateParams* params); |
| 163 | 179 |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 // Set of process hosts being prerendered. | 577 // Set of process hosts being prerendered. |
| 562 typedef std::set<content::RenderProcessHost*> PrerenderProcessSet; | 578 typedef std::set<content::RenderProcessHost*> PrerenderProcessSet; |
| 563 PrerenderProcessSet prerender_process_hosts_; | 579 PrerenderProcessSet prerender_process_hosts_; |
| 564 | 580 |
| 565 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 581 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 566 }; | 582 }; |
| 567 | 583 |
| 568 } // namespace prerender | 584 } // namespace prerender |
| 569 | 585 |
| 570 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 586 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |