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

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

Issue 2920473005: Consolidate isolated origin subframes into existing processes. (Closed)
Patch Set: Created 3 years, 7 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 | content/browser/isolated_origin_browsertest.cc » ('j') | 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 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;
}
« no previous file with comments | « no previous file | content/browser/isolated_origin_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698