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

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: Revise comment 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 // Keep subframes in the parent's SiteInstance unless a dedicated process is
1458 // required for either the parent or the subframe's destination URL. This
1459 // isn't a strict invariant but rather a heuristic to avoid unnecessary
1460 // OOPIFs; see https://crbug.com/711006. Note that this shouldn't apply to
1461 // TopDocumentIsolation, so do this after TDI checks above.
1462 if (!frame_tree_node_->IsMainFrame()) {
1463 RenderFrameHostImpl* parent =
1464 frame_tree_node_->parent()->current_frame_host();
1465 bool dest_url_requires_dedicated_process =
1466 SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context,
1467 dest_url);
1468 // Web iframes embedded in DevTools extensions should not reuse the parent
1469 // SiteInstance, but DevTools extensions are currently kept in the DevTools
1470 // SiteInstance, which is not considered to require a dedicated process.
1471 // Work around this by also checking whether the parent's URL requires a
1472 // dedicated process.
1473 // TODO(alexmos, nick): Remove this once https://crbug.com/706169 is fixed.
1474 bool parent_url_requires_dedicated_process =
1475 SiteInstanceImpl::DoesSiteRequireDedicatedProcess(
1476 browser_context, parent->last_successful_url());
1477 if (!parent->GetSiteInstance()->RequiresDedicatedProcess() &&
1478 !dest_url_requires_dedicated_process &&
1479 !parent_url_requires_dedicated_process) {
1480 return SiteInstanceDescriptor(parent->GetSiteInstance());
1481 }
1482 }
1483
1457 // Start the new renderer in a new SiteInstance, but in the current 1484 // Start the new renderer in a new SiteInstance, but in the current
1458 // BrowsingInstance. 1485 // BrowsingInstance.
1459 return SiteInstanceDescriptor(browser_context, dest_url, 1486 return SiteInstanceDescriptor(browser_context, dest_url,
1460 SiteInstanceRelation::RELATED); 1487 SiteInstanceRelation::RELATED);
1461 } 1488 }
1462 1489
1463 bool RenderFrameHostManager::IsRendererTransferNeededForNavigation( 1490 bool RenderFrameHostManager::IsRendererTransferNeededForNavigation(
1464 RenderFrameHostImpl* rfh, 1491 RenderFrameHostImpl* rfh,
1465 const GURL& dest_url) { 1492 const GURL& dest_url) {
1466 // A transfer is not needed if the current SiteInstance doesn't yet have a 1493 // 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()) { 2835 delegate_->IsHidden()) {
2809 if (delegate_->IsHidden()) { 2836 if (delegate_->IsHidden()) {
2810 render_frame_host_->GetView()->Hide(); 2837 render_frame_host_->GetView()->Hide();
2811 } else { 2838 } else {
2812 render_frame_host_->GetView()->Show(); 2839 render_frame_host_->GetView()->Show();
2813 } 2840 }
2814 } 2841 }
2815 } 2842 }
2816 2843
2817 } // namespace content 2844 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698