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 3458260ab9293609526d43fe63ff9f9405f75952..42c7e04c9958270c688f4ee3c21fa1f3d30b1e99 100644 |
--- a/content/browser/frame_host/render_frame_host_manager.cc |
+++ b/content/browser/frame_host/render_frame_host_manager.cc |
@@ -1262,6 +1262,19 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( |
// BrowserContext. |
DCHECK_EQ(new_instance->GetBrowserContext(), browser_context); |
+ // If |new_instance| is a new SiteInstance for a subframe with an isolated |
+ // origin, set its process reuse policy so that such subframes are |
+ // consolidated into existing processes for that isolated origin. |
+ SiteInstanceImpl* new_instance_impl = |
+ static_cast<SiteInstanceImpl*>(new_instance.get()); |
+ auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); |
+ if (!frame_tree_node_->IsMainFrame() && !new_instance_impl->HasProcess() && |
+ new_instance_impl->HasSite() && |
+ policy->IsIsolatedOrigin(url::Origin(new_instance_impl->GetSiteURL()))) { |
alexmos
2017/06/01 20:47:58
We could consider doing this for all subframes tha
Charlie Reis
2017/06/01 22:27:47
I like that idea. It would probably be safe to do
|
+ new_instance_impl->set_process_reuse_policy( |
+ SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE); |
+ } |
+ |
return new_instance; |
} |