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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 2809653008: Don't create unnecessary OOPIFs for subframe navigations that don't require a dedicated process. (Closed)
Patch Set: Fix devtools extensions tests Created 3 years, 8 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
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 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); 1447 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance());
1448 } 1448 }
1449 1449
1450 // This is a cross-site subframe of a non-isolated origin, so place this 1450 // This is a cross-site subframe of a non-isolated origin, so place this
1451 // frame in the default subframe site instance. 1451 // frame in the default subframe site instance.
1452 return SiteInstanceDescriptor( 1452 return SiteInstanceDescriptor(
1453 browser_context, dest_url, 1453 browser_context, dest_url,
1454 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); 1454 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME);
1455 } 1455 }
1456 1456
1457 // Subframes should be kept in the parent's SiteInstance unless a dedicated
1458 // process is required for either the parent or the subframe's destination
1459 // URL. See https://crbug.com/711006. Note that this should be
1460 // enforced after the TopDocumentIsolation checks above.
Charlie Reis 2017/04/14 16:57:05 I'm slightly wary about this invariant, since it f
alexmos 2017/04/17 17:36:02 Thanks, I agree. I updated the comment - let me k
1461 if (!frame_tree_node_->IsMainFrame()) {
1462 RenderFrameHostImpl* parent =
1463 frame_tree_node_->parent()->current_frame_host();
1464 bool dest_url_requires_dedicated_process =
1465 SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context,
1466 dest_url);
1467 // Web iframes embedded in DevTools extensions should not reuse the parent
1468 // SiteInstance, but DevTools extensions are currently kept in the DevTools
1469 // SiteInstance, which is not considered to require a dedicated process.
1470 // Work around this by also checking whether the parent's URL requires a
1471 // dedicated process.
1472 // TODO(alexmos, nick): Remove this once https://crbug.com/706169 is fixed.
1473 bool parent_url_requires_dedicated_process =
1474 SiteInstanceImpl::DoesSiteRequireDedicatedProcess(
1475 browser_context, parent->last_successful_url());
1476 if (!parent->GetSiteInstance()->RequiresDedicatedProcess() &&
1477 !dest_url_requires_dedicated_process &&
1478 !parent_url_requires_dedicated_process) {
alexmos 2017/04/14 00:15:46 Sigh, without this workaround, the devtools extens
Charlie Reis 2017/04/14 16:57:05 Fun. Devtools definitely should require a dedicat
1479 return SiteInstanceDescriptor(parent->GetSiteInstance());
1480 }
1481 }
1482
1457 // Start the new renderer in a new SiteInstance, but in the current 1483 // Start the new renderer in a new SiteInstance, but in the current
1458 // BrowsingInstance. 1484 // BrowsingInstance.
1459 return SiteInstanceDescriptor(browser_context, dest_url, 1485 return SiteInstanceDescriptor(browser_context, dest_url,
1460 SiteInstanceRelation::RELATED); 1486 SiteInstanceRelation::RELATED);
1461 } 1487 }
1462 1488
1463 bool RenderFrameHostManager::IsRendererTransferNeededForNavigation( 1489 bool RenderFrameHostManager::IsRendererTransferNeededForNavigation(
1464 RenderFrameHostImpl* rfh, 1490 RenderFrameHostImpl* rfh,
1465 const GURL& dest_url) { 1491 const GURL& dest_url) {
1466 // A transfer is not needed if the current SiteInstance doesn't yet have a 1492 // A transfer is not needed if the current SiteInstance doesn't yet have a
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 delegate_->IsHidden()) { 2834 delegate_->IsHidden()) {
2809 if (delegate_->IsHidden()) { 2835 if (delegate_->IsHidden()) {
2810 render_frame_host_->GetView()->Hide(); 2836 render_frame_host_->GetView()->Hide();
2811 } else { 2837 } else {
2812 render_frame_host_->GetView()->Show(); 2838 render_frame_host_->GetView()->Show();
2813 } 2839 }
2814 } 2840 }
2815 } 2841 }
2816 2842
2817 } // namespace content 2843 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698