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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 std::vector<PrerenderTracker::ChildRouteIdPair> main_rfh_ids_; | 492 std::vector<PrerenderTracker::ChildRouteIdPair> main_rfh_ids_; |
493 base::OneShotTimer<PendingSwap> merge_timeout_; | 493 base::OneShotTimer<PendingSwap> merge_timeout_; |
494 bool swap_successful_; | 494 bool swap_successful_; |
495 | 495 |
496 base::WeakPtrFactory<PendingSwap> weak_factory_; | 496 base::WeakPtrFactory<PendingSwap> weak_factory_; |
497 }; | 497 }; |
498 | 498 |
499 void SetPrerenderContentsFactory( | 499 void SetPrerenderContentsFactory( |
500 PrerenderContents::Factory* prerender_contents_factory); | 500 PrerenderContents::Factory* prerender_contents_factory); |
501 | 501 |
502 // Adds prerenders from the pending Prerenders, called by | |
503 // PrerenderContents::StartPendingPrerenders. | |
504 void StartPendingPrerenders( | |
505 int process_id, | |
506 ScopedVector<PrerenderContents::PendingPrerenderInfo>* pending_prerenders, | |
507 content::SessionStorageNamespace* session_storage_namespace); | |
508 | |
509 // Called by a PrerenderData to signal that the launcher has navigated away | 502 // Called by a PrerenderData to signal that the launcher has navigated away |
510 // from the context that launched the prerender. A user may have clicked | 503 // from the context that launched the prerender. A user may have clicked |
511 // a link in a page containing a <link rel=prerender> element, or the user | 504 // a link in a page containing a <link rel=prerender> element, or the user |
512 // might have committed an omnibox navigation. This is used to possibly | 505 // might have committed an omnibox navigation. This is used to possibly |
513 // shorten the TTL of the prerendered page. | 506 // shorten the TTL of the prerendered page. |
514 void SourceNavigatedAway(PrerenderData* prerender_data); | 507 void SourceNavigatedAway(PrerenderData* prerender_data); |
515 | 508 |
516 private: | 509 private: |
517 friend class ::InstantSearchPrerendererTest; | 510 friend class ::InstantSearchPrerendererTest; |
518 friend class PrerenderBrowserTest; | 511 friend class PrerenderBrowserTest; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 // after every mutation of active_prerenders_ that can possibly make it | 598 // after every mutation of active_prerenders_ that can possibly make it |
606 // unsorted (e.g. an insert, or changing an expiry time). | 599 // unsorted (e.g. an insert, or changing an expiry time). |
607 void SortActivePrerenders(); | 600 void SortActivePrerenders(); |
608 | 601 |
609 // Finds the active PrerenderData object for a running prerender matching | 602 // Finds the active PrerenderData object for a running prerender matching |
610 // |url| and |session_storage_namespace|. | 603 // |url| and |session_storage_namespace|. |
611 PrerenderData* FindPrerenderData( | 604 PrerenderData* FindPrerenderData( |
612 const GURL& url, | 605 const GURL& url, |
613 const content::SessionStorageNamespace* session_storage_namespace); | 606 const content::SessionStorageNamespace* session_storage_namespace); |
614 | 607 |
615 // If |child_id| and |route_id| correspond to a RenderView that is an active | |
616 // prerender, returns the PrerenderData object for that prerender. Otherwise, | |
617 // returns NULL. | |
618 PrerenderData* FindPrerenderDataForChildAndRoute(int child_id, int route_id); | |
619 | |
620 // Given the |prerender_contents|, find the iterator in active_prerenders_ | 608 // Given the |prerender_contents|, find the iterator in active_prerenders_ |
621 // correponding to the given prerender. | 609 // correponding to the given prerender. |
622 ScopedVector<PrerenderData>::iterator | 610 ScopedVector<PrerenderData>::iterator |
623 FindIteratorForPrerenderContents(PrerenderContents* prerender_contents); | 611 FindIteratorForPrerenderContents(PrerenderContents* prerender_contents); |
624 | 612 |
625 bool DoesRateLimitAllowPrerender(Origin origin) const; | 613 bool DoesRateLimitAllowPrerender(Origin origin) const; |
626 | 614 |
627 // Deletes old WebContents that have been replaced by prerendered ones. This | 615 // Deletes old WebContents that have been replaced by prerendered ones. This |
628 // is needed because they're replaced in a callback from the old WebContents, | 616 // is needed because they're replaced in a callback from the old WebContents, |
629 // so cannot immediately be deleted. | 617 // so cannot immediately be deleted. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 | 755 |
768 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 756 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
769 }; | 757 }; |
770 | 758 |
771 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 759 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
772 int render_process_id); | 760 int render_process_id); |
773 | 761 |
774 } // namespace prerender | 762 } // namespace prerender |
775 | 763 |
776 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 764 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |