| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 | 1439 |
| 1440 // Don't swap processes for extensions embedded in DevTools. See | 1440 // Don't swap processes for extensions embedded in DevTools. See |
| 1441 // https://crbug.com/564216. | 1441 // https://crbug.com/564216. |
| 1442 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) { | 1442 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) { |
| 1443 // TODO(nick): https://crbug.com/570483 Check to see if |dest_url| is a | 1443 // TODO(nick): https://crbug.com/570483 Check to see if |dest_url| is a |
| 1444 // devtools extension, and swap processes if not. | 1444 // devtools extension, and swap processes if not. |
| 1445 return false; | 1445 return false; |
| 1446 } | 1446 } |
| 1447 | 1447 |
| 1448 BrowserContext* context = rfh->GetSiteInstance()->GetBrowserContext(); | 1448 BrowserContext* context = rfh->GetSiteInstance()->GetBrowserContext(); |
| 1449 GURL effective_url = SiteInstanceImpl::GetEffectiveURL(context, dest_url); | |
| 1450 | |
| 1451 // TODO(nasko, nick): These following --site-per-process checks are | 1449 // TODO(nasko, nick): These following --site-per-process checks are |
| 1452 // overly simplistic. Update them to match all the cases | 1450 // overly simplistic. Update them to match all the cases |
| 1453 // considered by DetermineSiteInstanceForURL. | 1451 // considered by DetermineSiteInstanceForURL. |
| 1454 if (IsCurrentlySameSite(rfh, dest_url)) { | 1452 if (IsCurrentlySameSite(rfh, dest_url)) { |
| 1455 // The same site, no transition needed for security purposes, and we must | 1453 // The same site, no transition needed for security purposes, and we must |
| 1456 // keep the same SiteInstance for correctness of synchronous scripting. | 1454 // keep the same SiteInstance for correctness of synchronous scripting. |
| 1457 return false; | 1455 return false; |
| 1458 } | 1456 } |
| 1459 | 1457 |
| 1460 // The sites differ. If either one requires a dedicated process, | 1458 // The sites differ. If either one requires a dedicated process, |
| 1461 // then a transfer is needed. | 1459 // then a transfer is needed. |
| 1462 if (rfh->GetSiteInstance()->RequiresDedicatedProcess() || | 1460 if (rfh->GetSiteInstance()->RequiresDedicatedProcess() || |
| 1463 SiteInstanceImpl::DoesSiteRequireDedicatedProcess(context, | 1461 SiteInstanceImpl::DoesSiteRequireDedicatedProcess(context, |
| 1464 effective_url)) { | 1462 dest_url)) { |
| 1465 return true; | 1463 return true; |
| 1466 } | 1464 } |
| 1467 | 1465 |
| 1468 if (SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && | 1466 if (SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && |
| 1469 (!frame_tree_node_->IsMainFrame() || | 1467 (!frame_tree_node_->IsMainFrame() || |
| 1470 rfh->GetSiteInstance()->is_default_subframe_site_instance())) { | 1468 rfh->GetSiteInstance()->is_default_subframe_site_instance())) { |
| 1471 // Always attempt a transfer in these cases. | 1469 // Always attempt a transfer in these cases. |
| 1472 return true; | 1470 return true; |
| 1473 } | 1471 } |
| 1474 | 1472 |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 resolved_url)) { | 2677 resolved_url)) { |
| 2680 DCHECK(!dest_instance || | 2678 DCHECK(!dest_instance || |
| 2681 dest_instance == render_frame_host_->GetSiteInstance()); | 2679 dest_instance == render_frame_host_->GetSiteInstance()); |
| 2682 return false; | 2680 return false; |
| 2683 } | 2681 } |
| 2684 | 2682 |
| 2685 return true; | 2683 return true; |
| 2686 } | 2684 } |
| 2687 | 2685 |
| 2688 } // namespace content | 2686 } // namespace content |
| OLD | NEW |