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

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

Issue 1385603004: Move IsRendererTransferNeededForNavigation to RenderFrameHostManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_isolate_apps2
Patch Set: Pull in fixes from other patch Created 5 years, 2 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
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 1ffbbaa4861f5795c19410c982d11b26da767cdd..3b4ae3a9baa445739568803a40184eafae88e94f 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -1504,6 +1504,36 @@ RenderFrameHostManager::DetermineSiteInstanceForURL(
return SiteInstanceDescriptor(browser_context, dest_url, true);
}
+bool RenderFrameHostManager::IsRendererTransferNeededForNavigation(
+ RenderFrameHostImpl* rfh,
+ const GURL& dest_url) {
+ // A transfer is not needed if the current SiteInstance doesn't yet have a
+ // site. This is the case for tests that use NavigateToURL.
+ if (!rfh->GetSiteInstance()->HasSite())
+ return false;
+
+ // We do not currently swap processes for navigations in webview tag guests.
+ if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kGuestScheme))
+ return false;
+
+ GURL effective_url = SiteInstanceImpl::GetEffectiveURL(
+ rfh->GetSiteInstance()->GetBrowserContext(), dest_url);
+
+ // TODO(nasko, nick): These following --site-per-process checks are
+ // overly simplistic. Update them to match all the cases
+ // considered by DetermineSiteInstanceForURL.
+ if (SiteInstance::IsSameWebSite(rfh->GetSiteInstance()->GetBrowserContext(),
+ rfh->GetSiteInstance()->GetSiteURL(),
+ dest_url)) {
+ return false; // The same site, no transition needed.
+ }
+
+ // The sites differ. If either one requires a dedicated process,
+ // then a transfer is needed.
+ return rfh->GetSiteInstance()->RequiresDedicatedProcess() ||
+ SiteIsolationPolicy::DoesSiteRequireDedicatedProcess(effective_url);
+}
+
SiteInstance* RenderFrameHostManager::ConvertToSiteInstance(
const SiteInstanceDescriptor& descriptor,
SiteInstance* candidate_instance) {
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.h ('k') | content/browser/loader/cross_site_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698