Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Side by Side Diff: chrome/browser/prerender/prerender_manager.h

Issue 8392041: Prerendered tabs use the same SessionStorage namespace as the tab that triggered the prerender. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix NetInternals browser test Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // set the initial window size of the RenderViewHost used for prerendering. 94 // set the initial window size of the RenderViewHost used for prerendering.
95 // Returns true if the URL was added, false if it was not. 95 // Returns true if the URL was added, false if it was not.
96 // If the RenderViewHost source is itself prerendering, the prerender is added 96 // If the RenderViewHost source is itself prerendering, the prerender is added
97 // as a pending prerender. 97 // as a pending prerender.
98 bool AddPrerenderFromLinkRelPrerender(int process_id, int route_id, 98 bool AddPrerenderFromLinkRelPrerender(int process_id, int route_id,
99 const GURL& url, const GURL& referrer); 99 const GURL& url, const GURL& referrer);
100 100
101 // Adds a prerender for |url| if valid. As the prerender request is coming 101 // Adds a prerender for |url| if valid. As the prerender request is coming
102 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a 102 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a
103 // child or route id, or a referrer. This method uses sensible values for 103 // child or route id, or a referrer. This method uses sensible values for
104 // those. 104 // those. The |session_storage_namespace| can be determined at this time,
105 bool AddPrerenderFromOmnibox(const GURL& url); 105 // however, because it is based off of the destination tab rather than the
106 // current contents.
mmenke 2011/11/02 02:27:55 "Destination tab rather than the current contents"
cbentzel 2011/11/02 15:57:08 Fixed comment - thanks for pointing this out.
107 bool AddPrerenderFromOmnibox(
108 const GURL& url,
109 SessionStorageNamespace* session_storage_namespace);
106 110
107 // Destroy all prerenders for the given child route id pair and assign a final 111 // Destroy all prerenders for the given child route id pair and assign a final
108 // status to them. 112 // status to them.
109 virtual void DestroyPrerenderForRenderView(int process_id, int view_id, 113 virtual void DestroyPrerenderForRenderView(int process_id, int view_id,
110 FinalStatus final_status); 114 FinalStatus final_status);
111 115
112 // Cancels all active prerenders. 116 // Cancels all active prerenders.
113 void CancelAllPrerenders(); 117 void CancelAllPrerenders();
114 118
115 // For a given TabContents that wants to navigate to the URL supplied, 119 // For a given TabContents that wants to navigate to the URL supplied,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 242
239 struct PrerenderContentsData; 243 struct PrerenderContentsData;
240 struct NavigationRecord; 244 struct NavigationRecord;
241 245
242 class OnCloseTabContentsDeleter; 246 class OnCloseTabContentsDeleter;
243 247
244 class MostVisitedSites; 248 class MostVisitedSites;
245 249
246 // Adds a prerender for |url| from referrer |referrer| initiated from the 250 // Adds a prerender for |url| from referrer |referrer| initiated from the
247 // RenderViewHost specified by |child_route_id_pair|. The |origin| specifies 251 // RenderViewHost specified by |child_route_id_pair|. The |origin| specifies
248 // how the prerender was added. 252 // how the prerender was added. If the |session_storage_namespace| is NULL,
253 // it is discovered using the RenderViewHost specified by
254 // |child_route_id_pair|.
249 bool AddPrerender( 255 bool AddPrerender(
250 Origin origin, 256 Origin origin,
251 const std::pair<int, int>& child_route_id_pair, 257 const std::pair<int, int>& child_route_id_pair,
252 const GURL& url, 258 const GURL& url,
253 const GURL& referrer); 259 const GURL& referrer,
260 SessionStorageNamespace* session_storage_namespace);
254 261
255 // Adds a pending preload issued by the prerendering RenderView identified by 262 // Adds a pending preload issued by the prerendering RenderView identified by
256 // |child_route_id_pair|. If and when that prerendering RenderView is used, 263 // |child_route_id_pair|. If and when that prerendering RenderView is used,
257 // the specified prerender will start. 264 // the specified prerender will start.
258 void AddPendingPrerender(Origin origin, 265 void AddPendingPrerender(Origin origin,
259 const std::pair<int, int>& child_route_id_pair, 266 const std::pair<int, int>& child_route_id_pair,
260 const GURL& url, 267 const GURL& url,
261 const GURL& referrer); 268 const GURL& referrer);
262 269
263 // Retrieves the PrerenderContents object for the specified URL, if it 270 // Retrieves the PrerenderContents object for the specified URL, if it
(...skipping 22 matching lines...) Expand all
286 293
287 // Posts a task to call PeriodicCleanup. Results in quicker destruction of 294 // Posts a task to call PeriodicCleanup. Results in quicker destruction of
288 // objects. If |this| is deleted before the task is run, the task will 295 // objects. If |this| is deleted before the task is run, the task will
289 // automatically be cancelled. 296 // automatically be cancelled.
290 void PostCleanupTask(); 297 void PostCleanupTask();
291 298
292 bool IsPrerenderElementFresh(const base::Time start) const; 299 bool IsPrerenderElementFresh(const base::Time start) const;
293 void DeleteOldEntries(); 300 void DeleteOldEntries();
294 virtual base::Time GetCurrentTime() const; 301 virtual base::Time GetCurrentTime() const;
295 virtual base::TimeTicks GetCurrentTimeTicks() const; 302 virtual base::TimeTicks GetCurrentTimeTicks() const;
296 virtual PrerenderContents* CreatePrerenderContents(const GURL& url, 303 virtual PrerenderContents* CreatePrerenderContents(
297 const GURL& referrer, 304 SessionStorageNamespace* session_storage_namespace,
298 Origin origin, 305 const GURL& url,
299 uint8 experiment_id); 306 const GURL& referrer,
307 Origin origin,
308 uint8 experiment_id);
300 309
301 // Checks if the PrerenderContents has been added to the pending delete list. 310 // Checks if the PrerenderContents has been added to the pending delete list.
302 bool IsPendingDelete(PrerenderContents* entry) const; 311 bool IsPendingDelete(PrerenderContents* entry) const;
303 312
304 // Deletes any PrerenderContents that have been added to the pending delete 313 // Deletes any PrerenderContents that have been added to the pending delete
305 // list. 314 // list.
306 void DeletePendingDeleteEntries(); 315 void DeletePendingDeleteEntries();
307 316
308 // Finds the specified PrerenderContents and returns it, if it exists. 317 // Finds the specified PrerenderContents and returns it, if it exists.
309 // Returns NULL otherwise. Unlike GetEntry, the PrerenderManager maintains 318 // Returns NULL otherwise. Unlike GetEntry, the PrerenderManager maintains
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 423
415 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); 424 DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
416 }; 425 };
417 426
418 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( 427 PrerenderManager* FindPrerenderManagerUsingRenderProcessId(
419 int render_process_id); 428 int render_process_id);
420 429
421 } // namespace prerender 430 } // namespace prerender
422 431
423 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 432 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698