Chromium Code Reviews| 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/child_process_launcher.h" | 5 #include "content/browser/child_process_launcher.h" |
| 6 | 6 |
| 7 #include <utility> // For std::pair. | 7 #include <utility> // For std::pair. |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 | 174 |
| 175 void ChildProcessLauncher::Context::Launch( | 175 void ChildProcessLauncher::Context::Launch( |
| 176 SandboxedProcessLauncherDelegate* delegate, | 176 SandboxedProcessLauncherDelegate* delegate, |
| 177 base::CommandLine* cmd_line, | 177 base::CommandLine* cmd_line, |
| 178 int child_process_id, | 178 int child_process_id, |
| 179 Client* client) { | 179 Client* client) { |
| 180 CHECK(BrowserThread::GetCurrentThreadIdentifier(&client_thread_id_)); | 180 CHECK(BrowserThread::GetCurrentThreadIdentifier(&client_thread_id_)); |
| 181 client_ = client; | 181 client_ = client; |
| 182 | 182 |
| 183 #if defined(OS_ANDROID) | 183 #if defined(OS_ANDROID) |
| 184 // We currently only support renderer and gpu child processes. | 184 // Android only supports renderer, sandboxed utility and gpu. |
| 185 std::string process_type = | 185 std::string process_type = |
| 186 cmd_line->GetSwitchValueASCII(switches::kProcessType); | 186 cmd_line->GetSwitchValueASCII(switches::kProcessType); |
| 187 CHECK(process_type == switches::kGpuProcess || | 187 CHECK(process_type == switches::kGpuProcess || |
| 188 process_type == switches::kRendererProcess); | 188 process_type == switches::kRendererProcess || |
| 189 process_type == switches::kUtilityProcess) | |
| 190 << "Unsupported process type: " << process_type; | |
| 191 | |
| 192 // Non-sandboxed utility or rendererprocess are currently not supported. | |
|
Feng Qian
2014/12/12 20:59:46
nit: space between render and process.
no sievers
2014/12/12 21:14:14
Done.
| |
| 193 DCHECK(process_type == switches::kGpuProcess || | |
| 194 !cmd_line->HasSwitch(switches::kNoSandbox)); | |
| 189 | 195 |
| 190 // We need to close the client end of the IPC channel to reliably detect | 196 // We need to close the client end of the IPC channel to reliably detect |
| 191 // child termination. We will close this fd after we create the child | 197 // child termination. We will close this fd after we create the child |
| 192 // process which is asynchronous on Android. | 198 // process which is asynchronous on Android. |
| 193 ipcfd_.reset(delegate->TakeIpcFd().release()); | 199 ipcfd_.reset(delegate->TakeIpcFd().release()); |
| 194 #endif | 200 #endif |
| 195 BrowserThread::PostTask( | 201 BrowserThread::PostTask( |
| 196 BrowserThread::PROCESS_LAUNCHER, FROM_HERE, | 202 BrowserThread::PROCESS_LAUNCHER, FROM_HERE, |
| 197 base::Bind(&Context::LaunchInternal, | 203 base::Bind(&Context::LaunchInternal, |
| 198 make_scoped_refptr(this), | 204 make_scoped_refptr(this), |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 600 context_->SetProcessBackgrounded(background); | 606 context_->SetProcessBackgrounded(background); |
| 601 } | 607 } |
| 602 | 608 |
| 603 void ChildProcessLauncher::SetTerminateChildOnShutdown( | 609 void ChildProcessLauncher::SetTerminateChildOnShutdown( |
| 604 bool terminate_on_shutdown) { | 610 bool terminate_on_shutdown) { |
| 605 if (context_.get()) | 611 if (context_.get()) |
| 606 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); | 612 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); |
| 607 } | 613 } |
| 608 | 614 |
| 609 } // namespace content | 615 } // namespace content |
| OLD | NEW |