Chromium Code Reviews| 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); | 1449 GURL site_url = SiteInstanceImpl::GetSiteForURL(context, dest_url); |
| 1450 | 1450 |
| 1451 // TODO(nasko, nick): These following --site-per-process checks are | 1451 // TODO(nasko, nick): These following --site-per-process checks are |
| 1452 // overly simplistic. Update them to match all the cases | 1452 // overly simplistic. Update them to match all the cases |
| 1453 // considered by DetermineSiteInstanceForURL. | 1453 // considered by DetermineSiteInstanceForURL. |
| 1454 if (IsCurrentlySameSite(rfh, dest_url)) { | 1454 if (IsCurrentlySameSite(rfh, dest_url)) { |
| 1455 // The same site, no transition needed for security purposes, and we must | 1455 // The same site, no transition needed for security purposes, and we must |
| 1456 // keep the same SiteInstance for correctness of synchronous scripting. | 1456 // keep the same SiteInstance for correctness of synchronous scripting. |
| 1457 return false; | 1457 return false; |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 // The sites differ. If either one requires a dedicated process, | 1460 // The sites differ. If either one requires a dedicated process, |
| 1461 // then a transfer is needed. | 1461 // then a transfer is needed. |
| 1462 if (rfh->GetSiteInstance()->RequiresDedicatedProcess() || | 1462 if (rfh->GetSiteInstance()->RequiresDedicatedProcess() || |
| 1463 SiteInstanceImpl::DoesSiteRequireDedicatedProcess(context, | 1463 SiteInstanceImpl::DoesSiteRequireDedicatedProcess(context, site_url)) { |
|
Charlie Reis
2016/09/09 18:54:39
Can you explain why was passing the effective URL
| |
| 1464 effective_url)) { | |
| 1465 return true; | 1464 return true; |
| 1466 } | 1465 } |
| 1467 | 1466 |
| 1468 if (SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && | 1467 if (SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && |
| 1469 (!frame_tree_node_->IsMainFrame() || | 1468 (!frame_tree_node_->IsMainFrame() || |
| 1470 rfh->GetSiteInstance()->is_default_subframe_site_instance())) { | 1469 rfh->GetSiteInstance()->is_default_subframe_site_instance())) { |
| 1471 // Always attempt a transfer in these cases. | 1470 // Always attempt a transfer in these cases. |
| 1472 return true; | 1471 return true; |
| 1473 } | 1472 } |
| 1474 | 1473 |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2679 resolved_url)) { | 2678 resolved_url)) { |
| 2680 DCHECK(!dest_instance || | 2679 DCHECK(!dest_instance || |
| 2681 dest_instance == render_frame_host_->GetSiteInstance()); | 2680 dest_instance == render_frame_host_->GetSiteInstance()); |
| 2682 return false; | 2681 return false; |
| 2683 } | 2682 } |
| 2684 | 2683 |
| 2685 return true; | 2684 return true; |
| 2686 } | 2685 } |
| 2687 | 2686 |
| 2688 } // namespace content | 2687 } // namespace content |
| OLD | NEW |