| 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/browser_child_process_host_impl.h" | 5 #include "content/browser/browser_child_process_host_impl.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/dump_without_crashing.h" | 10 #include "base/debug/dump_without_crashing.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 BrowserChildProcessHost* BrowserChildProcessHost::Create( | 63 BrowserChildProcessHost* BrowserChildProcessHost::Create( |
| 64 content::ProcessType process_type, | 64 content::ProcessType process_type, |
| 65 BrowserChildProcessHostDelegate* delegate) { | 65 BrowserChildProcessHostDelegate* delegate) { |
| 66 return new BrowserChildProcessHostImpl(process_type, delegate); | 66 return new BrowserChildProcessHostImpl(process_type, delegate); |
| 67 } | 67 } |
| 68 | 68 |
| 69 BrowserChildProcessHost* BrowserChildProcessHost::FromID(int child_process_id) { |
| 70 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 71 BrowserChildProcessHostImpl::BrowserChildProcessList* process_list = |
| 72 g_child_process_list.Pointer(); |
| 73 for (BrowserChildProcessHostImpl* host : *process_list) { |
| 74 if (host->GetData().id == child_process_id) |
| 75 return host; |
| 76 } |
| 77 return nullptr; |
| 78 } |
| 79 |
| 69 #if defined(OS_MACOSX) | 80 #if defined(OS_MACOSX) |
| 70 base::ProcessMetrics::PortProvider* BrowserChildProcessHost::GetPortProvider() { | 81 base::ProcessMetrics::PortProvider* BrowserChildProcessHost::GetPortProvider() { |
| 71 return MachBroker::GetInstance(); | 82 return MachBroker::GetInstance(); |
| 72 } | 83 } |
| 73 #endif | 84 #endif |
| 74 | 85 |
| 75 // static | 86 // static |
| 76 BrowserChildProcessHostImpl::BrowserChildProcessList* | 87 BrowserChildProcessHostImpl::BrowserChildProcessList* |
| 77 BrowserChildProcessHostImpl::GetIterator() { | 88 BrowserChildProcessHostImpl::GetIterator() { |
| 78 return g_child_process_list.Pointer(); | 89 return g_child_process_list.Pointer(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 void BrowserChildProcessHostImpl::SetName(const base::string16& name) { | 191 void BrowserChildProcessHostImpl::SetName(const base::string16& name) { |
| 181 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 192 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 182 data_.name = name; | 193 data_.name = name; |
| 183 } | 194 } |
| 184 | 195 |
| 185 void BrowserChildProcessHostImpl::SetHandle(base::ProcessHandle handle) { | 196 void BrowserChildProcessHostImpl::SetHandle(base::ProcessHandle handle) { |
| 186 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 197 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 187 data_.handle = handle; | 198 data_.handle = handle; |
| 188 } | 199 } |
| 189 | 200 |
| 201 ServiceRegistry* BrowserChildProcessHostImpl::GetServiceRegistry() { |
| 202 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 203 return delegate_->GetServiceRegistry(); |
| 204 } |
| 205 |
| 190 void BrowserChildProcessHostImpl::ForceShutdown() { | 206 void BrowserChildProcessHostImpl::ForceShutdown() { |
| 191 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 207 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 192 g_child_process_list.Get().remove(this); | 208 g_child_process_list.Get().remove(this); |
| 193 child_process_host_->ForceShutdown(); | 209 child_process_host_->ForceShutdown(); |
| 194 } | 210 } |
| 195 | 211 |
| 196 void BrowserChildProcessHostImpl::SetBackgrounded(bool backgrounded) { | 212 void BrowserChildProcessHostImpl::SetBackgrounded(bool backgrounded) { |
| 197 child_process_->SetProcessBackgrounded(backgrounded); | 213 child_process_->SetProcessBackgrounded(backgrounded); |
| 198 } | 214 } |
| 199 | 215 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 365 |
| 350 #if defined(OS_WIN) | 366 #if defined(OS_WIN) |
| 351 | 367 |
| 352 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 368 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 353 OnChildDisconnected(); | 369 OnChildDisconnected(); |
| 354 } | 370 } |
| 355 | 371 |
| 356 #endif | 372 #endif |
| 357 | 373 |
| 358 } // namespace content | 374 } // namespace content |
| OLD | NEW |