OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 } | 1497 } |
1498 | 1498 |
1499 // Start the new renderer in a new SiteInstance, but in the current | 1499 // Start the new renderer in a new SiteInstance, but in the current |
1500 // BrowsingInstance. It is important to immediately give this new | 1500 // BrowsingInstance. It is important to immediately give this new |
1501 // SiteInstance to a RenderViewHost (if it is different than our current | 1501 // SiteInstance to a RenderViewHost (if it is different than our current |
1502 // SiteInstance), so that it is ref counted. This will happen in | 1502 // SiteInstance), so that it is ref counted. This will happen in |
1503 // CreateRenderView. | 1503 // CreateRenderView. |
1504 return SiteInstanceDescriptor(browser_context, dest_url, true); | 1504 return SiteInstanceDescriptor(browser_context, dest_url, true); |
1505 } | 1505 } |
1506 | 1506 |
| 1507 bool RenderFrameHostManager::IsRendererTransferNeededForNavigation( |
| 1508 RenderFrameHostImpl* rfh, |
| 1509 const GURL& dest_url) { |
| 1510 // A transfer is not needed if the current SiteInstance doesn't yet have a |
| 1511 // site. This is the case for tests that use NavigateToURL. |
| 1512 if (!rfh->GetSiteInstance()->HasSite()) |
| 1513 return false; |
| 1514 |
| 1515 // We do not currently swap processes for navigations in webview tag guests. |
| 1516 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kGuestScheme)) |
| 1517 return false; |
| 1518 |
| 1519 GURL effective_url = SiteInstanceImpl::GetEffectiveURL( |
| 1520 rfh->GetSiteInstance()->GetBrowserContext(), dest_url); |
| 1521 |
| 1522 // TODO(nasko, nick): These following --site-per-process checks are |
| 1523 // overly simplistic. Update them to match all the cases |
| 1524 // considered by DetermineSiteInstanceForURL. |
| 1525 if (SiteInstance::IsSameWebSite(rfh->GetSiteInstance()->GetBrowserContext(), |
| 1526 rfh->GetSiteInstance()->GetSiteURL(), |
| 1527 dest_url)) { |
| 1528 return false; // The same site, no transition needed. |
| 1529 } |
| 1530 |
| 1531 // The sites differ. If either one requires a dedicated process, |
| 1532 // then a transfer is needed. |
| 1533 return rfh->GetSiteInstance()->RequiresDedicatedProcess() || |
| 1534 SiteIsolationPolicy::DoesSiteRequireDedicatedProcess(effective_url); |
| 1535 } |
| 1536 |
1507 SiteInstance* RenderFrameHostManager::ConvertToSiteInstance( | 1537 SiteInstance* RenderFrameHostManager::ConvertToSiteInstance( |
1508 const SiteInstanceDescriptor& descriptor, | 1538 const SiteInstanceDescriptor& descriptor, |
1509 SiteInstance* candidate_instance) { | 1539 SiteInstance* candidate_instance) { |
1510 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); | 1540 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |
1511 | 1541 |
1512 // Note: If the |candidate_instance| matches the descriptor, it will already | 1542 // Note: If the |candidate_instance| matches the descriptor, it will already |
1513 // be set to |descriptor.existing_site_instance|. | 1543 // be set to |descriptor.existing_site_instance|. |
1514 if (descriptor.existing_site_instance) | 1544 if (descriptor.existing_site_instance) |
1515 return descriptor.existing_site_instance; | 1545 return descriptor.existing_site_instance; |
1516 | 1546 |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2622 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2593 if (!frame_tree_node_->opener()) | 2623 if (!frame_tree_node_->opener()) |
2594 return MSG_ROUTING_NONE; | 2624 return MSG_ROUTING_NONE; |
2595 | 2625 |
2596 return frame_tree_node_->opener() | 2626 return frame_tree_node_->opener() |
2597 ->render_manager() | 2627 ->render_manager() |
2598 ->GetRoutingIdForSiteInstance(instance); | 2628 ->GetRoutingIdForSiteInstance(instance); |
2599 } | 2629 } |
2600 | 2630 |
2601 } // namespace content | 2631 } // namespace content |
OLD | NEW |