OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/site_instance_impl.h" | 5 #include "content/browser/site_instance_impl.h" |
6 | 6 |
7 #include "content/browser/browsing_instance.h" | 7 #include "content/browser/browsing_instance.h" |
8 #include "content/browser/child_process_security_policy_impl.h" | 8 #include "content/browser/child_process_security_policy_impl.h" |
9 #include "content/browser/frame_host/debug_urls.h" | 9 #include "content/browser/frame_host/debug_urls.h" |
10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
361 // static | 361 // static |
362 GURL SiteInstanceImpl::GetEffectiveURL(BrowserContext* browser_context, | 362 GURL SiteInstanceImpl::GetEffectiveURL(BrowserContext* browser_context, |
363 const GURL& url) { | 363 const GURL& url) { |
364 return GetContentClient()->browser()-> | 364 return GetContentClient()->browser()-> |
365 GetEffectiveURL(browser_context, url); | 365 GetEffectiveURL(browser_context, url); |
366 } | 366 } |
367 | 367 |
368 // static | 368 // static |
369 bool SiteInstanceImpl::DoesSiteRequireDedicatedProcess( | 369 bool SiteInstanceImpl::DoesSiteRequireDedicatedProcess( |
370 BrowserContext* browser_context, | 370 BrowserContext* browser_context, |
371 const GURL& effective_url) { | 371 const GURL& url) { |
372 GURL site_url = GetSiteForURL(browser_context, url); | |
Charlie Reis
2016/09/09 21:18:23
nit: Let's add a comment explaining why we want th
ncarter (slow)
2016/09/09 21:56:32
Done.
| |
372 // If --site-per-process is enabled, site isolation is enabled everywhere. | 373 // If --site-per-process is enabled, site isolation is enabled everywhere. |
373 if (SiteIsolationPolicy::UseDedicatedProcessesForAllSites()) | 374 if (SiteIsolationPolicy::UseDedicatedProcessesForAllSites()) |
374 return true; | 375 return true; |
375 | 376 |
376 // Let the content embedder enable site isolation for specific URLs. | 377 // Let the content embedder enable site isolation for specific URLs. |
377 if (GetContentClient()->IsSupplementarySiteIsolationModeEnabled() && | 378 if (GetContentClient()->IsSupplementarySiteIsolationModeEnabled() && |
378 GetContentClient()->browser()->DoesSiteRequireDedicatedProcess( | 379 GetContentClient()->browser()->DoesSiteRequireDedicatedProcess( |
379 browser_context, effective_url)) { | 380 browser_context, site_url)) { |
380 return true; | 381 return true; |
381 } | 382 } |
382 | 383 |
383 return false; | 384 return false; |
384 } | 385 } |
385 | 386 |
386 void SiteInstanceImpl::RenderProcessHostDestroyed(RenderProcessHost* host) { | 387 void SiteInstanceImpl::RenderProcessHostDestroyed(RenderProcessHost* host) { |
387 DCHECK_EQ(process_, host); | 388 DCHECK_EQ(process_, host); |
388 process_->RemoveObserver(this); | 389 process_->RemoveObserver(this); |
389 process_ = nullptr; | 390 process_ = nullptr; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 browsing_instance_->browser_context(), site_)) | 430 browsing_instance_->browser_context(), site_)) |
430 return; | 431 return; |
431 | 432 |
432 ChildProcessSecurityPolicyImpl* policy = | 433 ChildProcessSecurityPolicyImpl* policy = |
433 ChildProcessSecurityPolicyImpl::GetInstance(); | 434 ChildProcessSecurityPolicyImpl::GetInstance(); |
434 policy->LockToOrigin(process_->GetID(), site_); | 435 policy->LockToOrigin(process_->GetID(), site_); |
435 } | 436 } |
436 } | 437 } |
437 | 438 |
438 } // namespace content | 439 } // namespace content |
OLD | NEW |