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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 const gfx::Size& size); | 117 const gfx::Size& size); |
118 | 118 |
119 // Adds a prerender for |url| if valid. As the prerender request is coming | 119 // Adds a prerender for |url| if valid. As the prerender request is coming |
120 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a | 120 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a |
121 // child or route id, or a referrer. This method uses sensible values for | 121 // child or route id, or a referrer. This method uses sensible values for |
122 // those. The |session_storage_namespace| matches the namespace of the active | 122 // those. The |session_storage_namespace| matches the namespace of the active |
123 // tab at the time the prerender is generated from the omnibox. Returns a | 123 // tab at the time the prerender is generated from the omnibox. Returns a |
124 // caller-owned PrerenderHandle*, or NULL. | 124 // caller-owned PrerenderHandle*, or NULL. |
125 PrerenderHandle* AddPrerenderFromOmnibox( | 125 PrerenderHandle* AddPrerenderFromOmnibox( |
126 const GURL& url, | 126 const GURL& url, |
127 content::SessionStorageNamespace* session_storage_namespace, | 127 const content::SessionStorageNamespaceMap& session_storage_namespace_map, |
128 const gfx::Size& size); | 128 const gfx::Size& size); |
129 | 129 |
130 // If |process_id| and |view_id| refer to a running prerender, destroy | 130 // If |process_id| and |view_id| refer to a running prerender, destroy |
131 // it with |final_status|. | 131 // it with |final_status|. |
132 virtual void DestroyPrerenderForRenderView(int process_id, | 132 virtual void DestroyPrerenderForRenderView(int process_id, |
133 int view_id, | 133 int view_id, |
134 FinalStatus final_status); | 134 FinalStatus final_status); |
135 | 135 |
136 // Cancels all active prerenders. | 136 // Cancels all active prerenders. |
137 void CancelAllPrerenders(); | 137 void CancelAllPrerenders(); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 // Adds a prerender from a pending Prerender, called by | 289 // Adds a prerender from a pending Prerender, called by |
290 // PrerenderContents::StartPendingPrerenders. | 290 // PrerenderContents::StartPendingPrerenders. |
291 void StartPendingPrerender( | 291 void StartPendingPrerender( |
292 PrerenderHandle* existing_prerender_handle, | 292 PrerenderHandle* existing_prerender_handle, |
293 Origin origin, | 293 Origin origin, |
294 int process_id, | 294 int process_id, |
295 const GURL& url, | 295 const GURL& url, |
296 const content::Referrer& referrer, | 296 const content::Referrer& referrer, |
297 const gfx::Size& size, | 297 const gfx::Size& size, |
298 content::SessionStorageNamespace* session_storage_namespace); | 298 const content::SessionStorageNamespaceMap& session_storage_namespace_map); |
299 | 299 |
300 void DestroyPendingPrerenderData(PrerenderData* pending_prerender_data); | 300 void DestroyPendingPrerenderData(PrerenderData* pending_prerender_data); |
301 | 301 |
302 // Utility method that is called from the virtual Shutdown method on this | 302 // Utility method that is called from the virtual Shutdown method on this |
303 // class but is called directly from the TestPrerenderManager in the unit | 303 // class but is called directly from the TestPrerenderManager in the unit |
304 // tests. | 304 // tests. |
305 void DoShutdown(); | 305 void DoShutdown(); |
306 | 306 |
307 private: | 307 private: |
308 friend class PrerenderBrowserTest; | 308 friend class PrerenderBrowserTest; |
(...skipping 18 matching lines...) Expand all Loading... |
327 // |child_id|. The |origin| specifies how the prerender was added. If |size| | 327 // |child_id|. The |origin| specifies how the prerender was added. If |size| |
328 // is empty, then PrerenderContents::StartPrerendering will instead use a | 328 // is empty, then PrerenderContents::StartPrerendering will instead use a |
329 // default from PrerenderConfig. Returns a PrerenderHandle*, owned by the | 329 // default from PrerenderConfig. Returns a PrerenderHandle*, owned by the |
330 // caller, or NULL. | 330 // caller, or NULL. |
331 PrerenderHandle* AddPrerender( | 331 PrerenderHandle* AddPrerender( |
332 Origin origin, | 332 Origin origin, |
333 int child_id, | 333 int child_id, |
334 const GURL& url, | 334 const GURL& url, |
335 const content::Referrer& referrer, | 335 const content::Referrer& referrer, |
336 const gfx::Size& size, | 336 const gfx::Size& size, |
337 content::SessionStorageNamespace* session_storage_namespace); | 337 const content::SessionStorageNamespaceMap& |
| 338 session_storage_namespace_map); |
338 | 339 |
339 void StartSchedulingPeriodicCleanups(); | 340 void StartSchedulingPeriodicCleanups(); |
340 void StopSchedulingPeriodicCleanups(); | 341 void StopSchedulingPeriodicCleanups(); |
341 | 342 |
342 void EvictOldestPrerendersIfNecessary(); | 343 void EvictOldestPrerendersIfNecessary(); |
343 | 344 |
344 // Deletes stale and cancelled prerendered PrerenderContents, as well as | 345 // Deletes stale and cancelled prerendered PrerenderContents, as well as |
345 // WebContents that have been replaced by prerendered WebContents. | 346 // WebContents that have been replaced by prerendered WebContents. |
346 // Also identifies and kills PrerenderContents that use too much | 347 // Also identifies and kills PrerenderContents that use too much |
347 // resources. | 348 // resources. |
(...skipping 16 matching lines...) Expand all Loading... |
364 uint8 experiment_id); | 365 uint8 experiment_id); |
365 | 366 |
366 // Deletes any PrerenderContents that have been added to the pending delete | 367 // Deletes any PrerenderContents that have been added to the pending delete |
367 // list. | 368 // list. |
368 void DeletePendingDeleteEntries(); | 369 void DeletePendingDeleteEntries(); |
369 | 370 |
370 // Finds the active PrerenderData object for a running prerender matching | 371 // Finds the active PrerenderData object for a running prerender matching |
371 // |url| and |session_storage_namespace|. | 372 // |url| and |session_storage_namespace|. |
372 PrerenderData* FindPrerenderData( | 373 PrerenderData* FindPrerenderData( |
373 const GURL& url, | 374 const GURL& url, |
374 const content::SessionStorageNamespace* session_storage_namespace); | 375 const content::SessionStorageNamespaceMap& session_storage_namespace_map); |
375 | 376 |
376 // If |child_id| and |route_id| correspond to a RenderView that is an active | 377 // If |child_id| and |route_id| correspond to a RenderView that is an active |
377 // prerender, returns the PrerenderData object for that prerender. Otherwise, | 378 // prerender, returns the PrerenderData object for that prerender. Otherwise, |
378 // returns NULL. | 379 // returns NULL. |
379 PrerenderData* FindPrerenderDataForChildAndRoute(int child_id, int route_id); | 380 PrerenderData* FindPrerenderDataForChildAndRoute(int child_id, int route_id); |
380 | 381 |
381 // Given the |prerender_contents|, find the iterator in active_prerender_list_ | 382 // Given the |prerender_contents|, find the iterator in active_prerender_list_ |
382 // correponding to the given prerender. | 383 // correponding to the given prerender. |
383 std::list<linked_ptr<PrerenderData> >::iterator | 384 std::list<linked_ptr<PrerenderData> >::iterator |
384 FindIteratorForPrerenderContents(PrerenderContents* prerender_contents); | 385 FindIteratorForPrerenderContents(PrerenderContents* prerender_contents); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 503 |
503 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 504 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
504 }; | 505 }; |
505 | 506 |
506 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 507 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
507 int render_process_id); | 508 int render_process_id); |
508 | 509 |
509 } // namespace prerender | 510 } // namespace prerender |
510 | 511 |
511 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 512 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |