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

Side by Side 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, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/isolated_origin_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 // current one. If we didn't, we would have two RenderFrameHosts in the same 1255 // current one. If we didn't, we would have two RenderFrameHosts in the same
1256 // SiteInstance and the same frame, breaking lookup of RenderFrameHosts by 1256 // SiteInstance and the same frame, breaking lookup of RenderFrameHosts by
1257 // SiteInstance. 1257 // SiteInstance.
1258 if (force_swap) 1258 if (force_swap)
1259 CHECK_NE(new_instance, current_instance); 1259 CHECK_NE(new_instance, current_instance);
1260 1260
1261 // Double-check that the new SiteInstance is associated with the right 1261 // Double-check that the new SiteInstance is associated with the right
1262 // BrowserContext. 1262 // BrowserContext.
1263 DCHECK_EQ(new_instance->GetBrowserContext(), browser_context); 1263 DCHECK_EQ(new_instance->GetBrowserContext(), browser_context);
1264 1264
1265 // If |new_instance| is a new SiteInstance for a subframe with an isolated
1266 // origin, set its process reuse policy so that such subframes are
1267 // consolidated into existing processes for that isolated origin.
1268 SiteInstanceImpl* new_instance_impl =
1269 static_cast<SiteInstanceImpl*>(new_instance.get());
1270 auto* policy = ChildProcessSecurityPolicyImpl::GetInstance();
1271 if (!frame_tree_node_->IsMainFrame() && !new_instance_impl->HasProcess() &&
1272 new_instance_impl->HasSite() &&
1273 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
1274 new_instance_impl->set_process_reuse_policy(
1275 SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE);
1276 }
1277
1265 return new_instance; 1278 return new_instance;
1266 } 1279 }
1267 1280
1268 RenderFrameHostManager::SiteInstanceDescriptor 1281 RenderFrameHostManager::SiteInstanceDescriptor
1269 RenderFrameHostManager::DetermineSiteInstanceForURL( 1282 RenderFrameHostManager::DetermineSiteInstanceForURL(
1270 const GURL& dest_url, 1283 const GURL& dest_url,
1271 SiteInstance* source_instance, 1284 SiteInstance* source_instance,
1272 SiteInstance* current_instance, 1285 SiteInstance* current_instance,
1273 SiteInstance* dest_instance, 1286 SiteInstance* dest_instance,
1274 ui::PageTransition transition, 1287 ui::PageTransition transition,
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 delegate_->IsHidden()) { 2869 delegate_->IsHidden()) {
2857 if (delegate_->IsHidden()) { 2870 if (delegate_->IsHidden()) {
2858 render_frame_host_->GetView()->Hide(); 2871 render_frame_host_->GetView()->Hide();
2859 } else { 2872 } else {
2860 render_frame_host_->GetView()->Show(); 2873 render_frame_host_->GetView()->Show();
2861 } 2874 }
2862 } 2875 }
2863 } 2876 }
2864 2877
2865 } // namespace content 2878 } // namespace content
OLDNEW
« 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