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. |
| 185 std::string process_type = |
| 186 cmd_line->GetSwitchValueASCII(switches::kProcessType); |
| 187 CHECK_NE(switches::kPluginProcess, process_type); |
| 188 CHECK_NE(switches::kPpapiBrokerProcess, process_type); |
| 189 CHECK_NE(switches::kPpapiPluginProcess, process_type); |
| 190 CHECK_NE(switches::kSandboxIPCProcess, process_type); |
| 191 CHECK_NE(switches::kUtilityProcess, process_type); |
| 192 CHECK_NE(switches::kZygoteProcess, process_type); |
| 193 CHECK(process_type == switches::kGpuProcess || |
| 194 process_type == switches::kRendererProcess); |
| 195 |
184 // 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 |
185 // 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 |
186 // process which is asynchronous on Android. | 198 // process which is asynchronous on Android. |
187 ipcfd_.reset(delegate->TakeIpcFd().release()); | 199 ipcfd_.reset(delegate->TakeIpcFd().release()); |
188 #endif | 200 #endif |
189 BrowserThread::PostTask( | 201 BrowserThread::PostTask( |
190 BrowserThread::PROCESS_LAUNCHER, FROM_HERE, | 202 BrowserThread::PROCESS_LAUNCHER, FROM_HERE, |
191 base::Bind(&Context::LaunchInternal, | 203 base::Bind(&Context::LaunchInternal, |
192 make_scoped_refptr(this), | 204 make_scoped_refptr(this), |
193 client_thread_id_, | 205 client_thread_id_, |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 context_->SetProcessBackgrounded(background); | 606 context_->SetProcessBackgrounded(background); |
595 } | 607 } |
596 | 608 |
597 void ChildProcessLauncher::SetTerminateChildOnShutdown( | 609 void ChildProcessLauncher::SetTerminateChildOnShutdown( |
598 bool terminate_on_shutdown) { | 610 bool terminate_on_shutdown) { |
599 if (context_.get()) | 611 if (context_.get()) |
600 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); | 612 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); |
601 } | 613 } |
602 | 614 |
603 } // namespace content | 615 } // namespace content |
OLD | NEW |