Chromium Code Reviews| Index: chrome/browser/prerender/prerender_manager.h |
| diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h |
| index 0245b2c992cc9b40150bcb0308cae751941c5fc2..b473e6920ddb87756582f69d58acc5332cb4540b 100644 |
| --- a/chrome/browser/prerender/prerender_manager.h |
| +++ b/chrome/browser/prerender/prerender_manager.h |
| @@ -159,6 +159,11 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
| content::WebContents* web_contents, |
| const GURL& url); |
| + // Records the percentage of pixels of the final page in place at swap-in. |
| + void RecordFractionPixelsFinalAtSwapin( |
| + content::WebContents* web_contents, |
| + double fraction); |
| + |
| // Set whether prerendering is currently enabled for this manager. |
| // Must be called on the UI thread. |
| // If |enabled| is false, existing prerendered pages will still persist until |
| @@ -189,14 +194,22 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
| // Maintaining and querying the set of WebContents belonging to this |
| // PrerenderManager that are currently showing prerendered pages. |
| - void MarkWebContentsAsPrerendered(content::WebContents* web_contents); |
| + void MarkWebContentsAsPrerendered(content::WebContents* web_contents, |
| + Origin origin); |
| + |
| void MarkWebContentsAsWouldBePrerendered(content::WebContents* web_contents); |
| void MarkWebContentsAsNotPrerendered(content::WebContents* web_contents); |
| - bool IsWebContentsPrerendered(content::WebContents* web_contents) const; |
| + |
| + // Returns true if |web_contents| is being prerendered. The optional parameter |
|
mmenke
2012/10/08 18:20:07
Could you fix this comment as well? It's actually
gavinp
2012/10/10 18:14:56
Done.
|
| + // |origin| is an output parameter which, if a prerender is found, is set to |
| + // the Origin of the prerender of |web_contents|. |
| + bool IsWebContentsPrerendered(content::WebContents* web_contents, |
| + Origin* origin) const; |
| + |
| bool WouldWebContentsBePrerendered(content::WebContents* web_contents) const; |
| // Checks whether |url| has been recently navigated to. |
| - bool HasRecentlyBeenNavigatedTo(const GURL& url); |
| + bool HasRecentlyBeenNavigatedTo(Origin origin, const GURL& url); |
| // Returns true if the method given is invalid for prerendering. |
| static bool IsValidHttpMethod(const std::string& method); |
| @@ -242,7 +255,7 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
| Profile* profile() const { return profile_; } |
| - PrerenderHistograms* histograms() const { return histograms_.get(); } |
| + PrerenderHistograms* histograms() { return histograms_.get(); } |
| protected: |
| class PrerenderData : public base::SupportsWeakPtr<PrerenderData> { |
| @@ -334,6 +347,11 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
| class OnCloseTabContentsDeleter; |
| struct NavigationRecord; |
| + struct PrerenderedWebContentsData { |
| + Origin origin; |
| + |
| + explicit PrerenderedWebContentsData(Origin origin); |
| + }; |
| typedef base::hash_map<content::WebContents*, bool> WouldBePrerenderedMap; |
| @@ -411,7 +429,7 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
| std::list<linked_ptr<PrerenderData> >::iterator |
| FindIteratorForPrerenderContents(PrerenderContents* prerender_contents); |
| - bool DoesRateLimitAllowPrerender() const; |
| + bool DoesRateLimitAllowPrerender(Origin origin) const; |
| // Deletes old WebContents that have been replaced by prerendered ones. This |
| // is needed because they're replaced in a callback from the old WebContents, |
| @@ -484,8 +502,12 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
| // List of prerender elements to be deleted |
| std::list<PrerenderContents*> pending_delete_list_; |
| - // Set of WebContents which are currently displaying a prerendered page. |
| - base::hash_set<content::WebContents*> prerendered_tab_contents_set_; |
| + // This map is from all WebContents which are currently displaying a |
| + // prerendered page which has already been swapped in to a |
| + // PrerenderedWebContentsData for tracking full lifetime information |
| + // on prerenders. |
| + base::hash_map<content::WebContents*, PrerenderedWebContentsData> |
| + prerendered_web_contents_data_; |
| // WebContents that would have been swapped out for a prerendered WebContents |
| // if the user was not part of the control group for measurement. When the |