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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 967383002: PlzNavigate: Avoid duplicate SiteInstance creation during navigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved the logic into GetSiteInstanceForNavigation. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index f9e2bf976fcbe85f71d53b78f7fbd8fe5bcf37f9..2c5bd18c595b79f62b3a94a8699613620eeea8c1 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -994,9 +994,20 @@ SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation(
SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url),
dest_is_view_source_mode);
if (ShouldTransitionCrossSite() || force_swap) {
- new_instance = GetSiteInstanceForURL(
- dest_url, source_instance, current_instance, dest_instance,
- transition, dest_is_restore, dest_is_view_source_mode, force_swap);
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation) &&
+ speculative_render_frame_host_ &&
+ speculative_render_frame_host_->GetSiteInstance()->GetSiteURL() ==
+ SiteInstanceImpl::GetSiteForURL(browser_context, dest_url)) {
Charlie Reis 2015/03/05 04:27:11 SiteInstanceImpl::GetSiteForURL is not equivalent
carlosk 2015/03/06 16:03:54 Acknowledged.
+ // We already created a new SiteInstance for this specific URL during this
+ // navigation and used it to create the speculative RenderFrameHost, so
+ // there's no need to create yet another new one.
+ new_instance = speculative_render_frame_host_->GetSiteInstance();
+ } else {
+ new_instance = GetSiteInstanceForURL(
+ dest_url, source_instance, current_instance, dest_instance,
+ transition, dest_is_restore, dest_is_view_source_mode, force_swap);
+ }
}
// If force_swap is true, we must use a different SiteInstance. If we didn't,
@@ -1096,7 +1107,7 @@ SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL(
// create a new SiteInstance.
if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL(
browser_context, dest_url)) {
- return SiteInstance::CreateForURL(browser_context, dest_url);
+ return SiteInstance::CreateForURL(browser_context, dest_url);
}
// Normally the "site" on the SiteInstance is set lazily when the load
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698