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

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

Issue 10831116: Move SessionStorageNamespace entirely into NavigationController and support StoragePartitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged ToT Created 8 years, 4 months 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) 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 #include "chrome/browser/prerender/prerender_manager.h" 5 #include "chrome/browser/prerender/prerender_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 } 227 }
228 228
229 // Unit tests pass in a process_id == -1. 229 // Unit tests pass in a process_id == -1.
230 SessionStorageNamespace* session_storage_namespace = NULL; 230 SessionStorageNamespace* session_storage_namespace = NULL;
231 if (process_id != -1) { 231 if (process_id != -1) {
232 RenderViewHost* source_render_view_host = 232 RenderViewHost* source_render_view_host =
233 RenderViewHost::FromID(process_id, route_id); 233 RenderViewHost::FromID(process_id, route_id);
234 if (!source_render_view_host) 234 if (!source_render_view_host)
235 return NULL; 235 return NULL;
236 WebContents* source_web_contents =
237 WebContents::FromRenderViewHost(source_render_view_host);
238 if (!source_web_contents)
239 return NULL;
240 // TODO(ajwong): This does not correctly handle storage for isolated apps.
236 session_storage_namespace = 241 session_storage_namespace =
237 source_render_view_host->GetSessionStorageNamespace(); 242 source_web_contents->GetController()
243 .GetDefaultSessionStorageNamespace();
238 } 244 }
239 245
240 return AddPrerender(ORIGIN_LINK_REL_PRERENDER, 246 return AddPrerender(ORIGIN_LINK_REL_PRERENDER,
241 process_id, url, referrer, size, 247 process_id, url, referrer, size,
242 session_storage_namespace); 248 session_storage_namespace);
243 #endif 249 #endif
244 } 250 }
245 251
246 PrerenderHandle* PrerenderManager::AddPrerenderFromOmnibox( 252 PrerenderHandle* PrerenderManager::AddPrerenderFromOmnibox(
247 const GURL& url, 253 const GURL& url,
(...skipping 21 matching lines...) Expand all
269 active_prerender_list_.front()->contents(); 275 active_prerender_list_.front()->contents();
270 prerender_contents->Destroy(FINAL_STATUS_CANCELLED); 276 prerender_contents->Destroy(FINAL_STATUS_CANCELLED);
271 } 277 }
272 } 278 }
273 279
274 bool PrerenderManager::MaybeUsePrerenderedPage(WebContents* web_contents, 280 bool PrerenderManager::MaybeUsePrerenderedPage(WebContents* web_contents,
275 const GURL& url) { 281 const GURL& url) {
276 DCHECK(CalledOnValidThread()); 282 DCHECK(CalledOnValidThread());
277 DCHECK(!IsWebContentsPrerendering(web_contents)); 283 DCHECK(!IsWebContentsPrerendering(web_contents));
278 284
279 RenderViewHost* old_render_view_host = web_contents->GetRenderViewHost();
280
281 DeleteOldEntries(); 285 DeleteOldEntries();
282 DeletePendingDeleteEntries(); 286 DeletePendingDeleteEntries();
287 // TODO(ajwong): This doesn't handle isolated apps correctly.
283 PrerenderData* prerender_data = FindPrerenderData( 288 PrerenderData* prerender_data = FindPrerenderData(
284 url, old_render_view_host->GetSessionStorageNamespace()); 289 url,
290 web_contents->GetController().GetDefaultSessionStorageNamespace());
285 if (!prerender_data) 291 if (!prerender_data)
286 return false; 292 return false;
287 DCHECK(prerender_data->contents_); 293 DCHECK(prerender_data->contents_);
288 if (IsNoSwapInExperiment(prerender_data->contents_->experiment_id())) 294 if (IsNoSwapInExperiment(prerender_data->contents_->experiment_id()))
289 return false; 295 return false;
290 296
291 if (TabContents* new_tab_contents = 297 if (TabContents* new_tab_contents =
292 prerender_data->contents_->prerender_contents()) { 298 prerender_data->contents_->prerender_contents()) {
293 if (web_contents == new_tab_contents->web_contents()) 299 if (web_contents == new_tab_contents->web_contents())
294 return false; // Do not swap in to ourself. 300 return false; // Do not swap in to ourself.
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 if (!render_process_host || !render_process_host->GetBrowserContext()) 1234 if (!render_process_host || !render_process_host->GetBrowserContext())
1229 return NULL; 1235 return NULL;
1230 Profile* profile = Profile::FromBrowserContext( 1236 Profile* profile = Profile::FromBrowserContext(
1231 render_process_host->GetBrowserContext()); 1237 render_process_host->GetBrowserContext());
1232 if (!profile) 1238 if (!profile)
1233 return NULL; 1239 return NULL;
1234 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); 1240 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile);
1235 } 1241 }
1236 1242
1237 } // namespace prerender 1243 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_contents.cc ('k') | chrome/browser/sessions/session_restore_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698