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

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: 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 | « content/browser/frame_host/render_frame_host_manager.h ('k') | 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..ef083f7a38a6caa3db65599d3034138af3b68135 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -1033,7 +1033,7 @@ SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL(
// If a swap is required, we need to force the SiteInstance AND
// BrowsingInstance to be different ones, using CreateForURL.
if (force_browsing_instance_swap)
- return SiteInstance::CreateForURL(browser_context, dest_url);
+ return CreateSiteInstanceForURL(browser_context, dest_url);
// (UGLY) HEURISTIC, process-per-site only:
//
@@ -1090,13 +1090,13 @@ SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL(
// should be taken into account when refactoring this method as part of
// http://crbug.com/123007.
if (dest_is_view_source_mode)
- return SiteInstance::CreateForURL(browser_context, dest_url);
+ return CreateSiteInstanceForURL(browser_context, dest_url);
// If we are navigating from a blank SiteInstance to a WebUI, make sure we
// create a new SiteInstance.
if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL(
browser_context, dest_url)) {
- return SiteInstance::CreateForURL(browser_context, dest_url);
+ return CreateSiteInstanceForURL(browser_context, dest_url);
}
// Normally the "site" on the SiteInstance is set lazily when the load
@@ -1146,7 +1146,7 @@ SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL(
if (current_entry &&
current_entry->IsViewSourceMode() != dest_is_view_source_mode &&
!IsRendererDebugURL(dest_url)) {
- return SiteInstance::CreateForURL(browser_context, dest_url);
+ return CreateSiteInstanceForURL(browser_context, dest_url);
}
// Use the source SiteInstance in case of data URLs or about:blank pages,
@@ -1175,6 +1175,22 @@ SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL(
return current_instance->GetRelatedSiteInstance(dest_url);
}
+SiteInstance* RenderFrameHostManager::CreateSiteInstanceForURL(
+ BrowserContext* browser_context,
+ const GURL& dest_url) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation) &&
+ speculative_render_frame_host_ &&
+ speculative_render_frame_host_->GetSiteInstance()->GetSiteURL() ==
nasko 2015/03/02 23:02:09 This check doesn't seem quite right. The SiteInsta
nasko 2015/03/02 23:19:47 If I follow things right, you probably want to cal
carlosk 2015/03/03 13:42:41 Yes, indeed. This is the right thing to do. If th
+ dest_url) {
+ // We already created a new SiteInstance for this specific URL for this same
+ // navigation and stored it in the speculative RenderFrameHost, so there's
+ // no need to create a new one again.
+ return speculative_render_frame_host_->GetSiteInstance();
+ }
+ return SiteInstance::CreateForURL(browser_context, dest_url);
+}
+
const GURL& RenderFrameHostManager::GetCurrentURLForSiteInstance(
SiteInstance* current_instance, NavigationEntry* current_entry) {
// If this is a subframe that is potentially out of process from its parent,
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698