| 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 "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "content/browser/browsing_instance.h" | 8 #include "content/browser/browsing_instance.h" |
| 9 #include "content/browser/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
| 10 #include "content/browser/frame_host/debug_urls.h" | 10 #include "content/browser/frame_host/debug_urls.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // may not be correct, so we'll wind up potentially creating a process that | 88 // may not be correct, so we'll wind up potentially creating a process that |
| 89 // we then throw away, or worse sharing a process with the wrong process type. | 89 // we then throw away, or worse sharing a process with the wrong process type. |
| 90 // See crbug.com/43448. | 90 // See crbug.com/43448. |
| 91 | 91 |
| 92 // Create a new process if ours went away or was reused. | 92 // Create a new process if ours went away or was reused. |
| 93 if (!process_) { | 93 if (!process_) { |
| 94 BrowserContext* browser_context = browsing_instance_->browser_context(); | 94 BrowserContext* browser_context = browsing_instance_->browser_context(); |
| 95 | 95 |
| 96 // Check if the ProcessReusePolicy should be updated. | 96 // Check if the ProcessReusePolicy should be updated. |
| 97 bool should_use_process_per_site = | 97 bool should_use_process_per_site = |
| 98 RenderProcessHost::ShouldUseProcessPerSite(browser_context, site_) && | 98 has_site_ && |
| 99 has_site_; | 99 RenderProcessHost::ShouldUseProcessPerSite(browser_context, site_); |
| 100 if (should_use_process_per_site) { | 100 if (should_use_process_per_site) { |
| 101 process_reuse_policy_ = ProcessReusePolicy::PROCESS_PER_SITE; | 101 process_reuse_policy_ = ProcessReusePolicy::PROCESS_PER_SITE; |
| 102 } else if (process_reuse_policy_ == ProcessReusePolicy::PROCESS_PER_SITE) { | 102 } else if (process_reuse_policy_ == ProcessReusePolicy::PROCESS_PER_SITE) { |
| 103 process_reuse_policy_ = ProcessReusePolicy::DEFAULT; | 103 process_reuse_policy_ = ProcessReusePolicy::DEFAULT; |
| 104 } | 104 } |
| 105 | 105 |
| 106 process_ = RenderProcessHostImpl::GetProcessHostForSiteInstance( | 106 process_ = RenderProcessHostImpl::GetProcessHostForSiteInstance( |
| 107 browser_context, this); | 107 browser_context, this); |
| 108 | 108 |
| 109 CHECK(process_); | 109 CHECK(process_); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 browsing_instance_->browser_context(), site_)) | 426 browsing_instance_->browser_context(), site_)) |
| 427 return; | 427 return; |
| 428 | 428 |
| 429 ChildProcessSecurityPolicyImpl* policy = | 429 ChildProcessSecurityPolicyImpl* policy = |
| 430 ChildProcessSecurityPolicyImpl::GetInstance(); | 430 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 431 policy->LockToOrigin(process_->GetID(), site_); | 431 policy->LockToOrigin(process_->GetID(), site_); |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 | 434 |
| 435 } // namespace content | 435 } // namespace content |
| OLD | NEW |