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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 | 194 |
195 // Maintaining and querying the set of WebContents belonging to this | 195 // Maintaining and querying the set of WebContents belonging to this |
196 // PrerenderManager that are currently showing prerendered pages. | 196 // PrerenderManager that are currently showing prerendered pages. |
197 void MarkWebContentsAsPrerendered(content::WebContents* web_contents, | 197 void MarkWebContentsAsPrerendered(content::WebContents* web_contents, |
198 Origin origin); | 198 Origin origin); |
199 | 199 |
200 void MarkWebContentsAsWouldBePrerendered(content::WebContents* web_contents); | 200 void MarkWebContentsAsWouldBePrerendered(content::WebContents* web_contents); |
201 void MarkWebContentsAsNotPrerendered(content::WebContents* web_contents); | 201 void MarkWebContentsAsNotPrerendered(content::WebContents* web_contents); |
202 | 202 |
203 // Returns true if |web_contents| is being prerendered. The optional parameter | 203 // Returns true if |web_contents| is being prerendered. The optional parameter |
204 // |origin| is an output parameter which, if a prerender is found, is set to | 204 // |origin| is an output parameter which if passed non-null is set to point |
205 // the Origin of the prerender of |web_contents|. | 205 // to the Origin of that prerender if one is found, NULL otherwise. |
206 bool IsWebContentsPrerendered(content::WebContents* web_contents, | 206 bool IsWebContentsPrerendered(content::WebContents* web_contents, |
207 Origin* origin) const; | 207 const Origin** origin) const; |
dominich
2012/10/08 17:03:04
this can stay as Origin* and still be optional and
gavinp
2012/10/08 17:09:36
Yes. Bad merge/rebase; I'll fix and reupload.
| |
208 | 208 |
209 bool WouldWebContentsBePrerendered(content::WebContents* web_contents) const; | 209 bool WouldWebContentsBePrerendered(content::WebContents* web_contents) const; |
210 | 210 |
211 // Checks whether |url| has been recently navigated to. | 211 // Checks whether |url| has been recently navigated to. |
212 bool HasRecentlyBeenNavigatedTo(Origin origin, const GURL& url); | 212 bool HasRecentlyBeenNavigatedTo(Origin origin, const GURL& url); |
213 | 213 |
214 // Returns true if the method given is invalid for prerendering. | 214 // Returns true if the method given is invalid for prerendering. |
215 static bool IsValidHttpMethod(const std::string& method); | 215 static bool IsValidHttpMethod(const std::string& method); |
216 | 216 |
217 // Returns a Value object containing the active pages being prerendered, and | 217 // Returns a Value object containing the active pages being prerendered, and |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 // List of all pending prerenders. | 495 // List of all pending prerenders. |
496 std::list<linked_ptr<PrerenderData> > pending_prerender_list_; | 496 std::list<linked_ptr<PrerenderData> > pending_prerender_list_; |
497 | 497 |
498 // List of recent navigations in this profile, sorted by ascending | 498 // List of recent navigations in this profile, sorted by ascending |
499 // navigate_time_. | 499 // navigate_time_. |
500 std::list<NavigationRecord> navigations_; | 500 std::list<NavigationRecord> navigations_; |
501 | 501 |
502 // List of prerender elements to be deleted | 502 // List of prerender elements to be deleted |
503 std::list<PrerenderContents*> pending_delete_list_; | 503 std::list<PrerenderContents*> pending_delete_list_; |
504 | 504 |
505 // This map is from all WebContents which are currently displaying a | 505 // Set of WebContents which are currently displaying a prerendered page. |
506 // prerendered page which has already been swapped in to a | |
507 // PrerenderedWebContentsData for tracking full lifetime information | |
508 // on prerenders. | |
509 base::hash_map<content::WebContents*, PrerenderedWebContentsData> | 506 base::hash_map<content::WebContents*, PrerenderedWebContentsData> |
510 prerendered_web_contents_data_; | 507 prerendered_web_contents_data_; |
511 | 508 |
512 // WebContents that would have been swapped out for a prerendered WebContents | 509 // WebContents that would have been swapped out for a prerendered WebContents |
513 // if the user was not part of the control group for measurement. When the | 510 // if the user was not part of the control group for measurement. When the |
514 // WebContents gets a provisional load, the WebContents is removed from | 511 // WebContents gets a provisional load, the WebContents is removed from |
515 // the map since the new navigation would not have swapped in a prerender. | 512 // the map since the new navigation would not have swapped in a prerender. |
516 // However, one complication exists because the first provisional load after | 513 // However, one complication exists because the first provisional load after |
517 // the WebContents is marked as "Would Have Been Prerendered" is actually to | 514 // the WebContents is marked as "Would Have Been Prerendered" is actually to |
518 // the prerendered location. So, we need to keep a boolean around that does | 515 // the prerendered location. So, we need to keep a boolean around that does |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
552 | 549 |
553 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 550 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
554 }; | 551 }; |
555 | 552 |
556 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 553 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
557 int render_process_id); | 554 int render_process_id); |
558 | 555 |
559 } // namespace prerender | 556 } // namespace prerender |
560 | 557 |
561 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 558 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |