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/utility_process_host_impl.h" | 5 #include "content/browser/utility_process_host_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
19 #include "base/sequenced_task_runner.h" | 19 #include "base/sequenced_task_runner.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
22 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "content/browser/browser_child_process_host_impl.h" | 24 #include "content/browser/browser_child_process_host_impl.h" |
25 #include "content/browser/mojo/mojo_child_connection.h" | |
26 #include "content/browser/mojo/mojo_shell_context.h" | 25 #include "content/browser/mojo/mojo_shell_context.h" |
27 #include "content/browser/renderer_host/render_process_host_impl.h" | 26 #include "content/browser/renderer_host/render_process_host_impl.h" |
28 #include "content/common/child_process_host_impl.h" | 27 #include "content/common/child_process_host_impl.h" |
29 #include "content/common/in_process_child_thread_params.h" | 28 #include "content/common/in_process_child_thread_params.h" |
30 #include "content/common/mojo/constants.h" | 29 #include "content/common/mojo/constants.h" |
| 30 #include "content/common/mojo/mojo_child_connection.h" |
31 #include "content/common/utility_messages.h" | 31 #include "content/common/utility_messages.h" |
32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
33 #include "content/public/browser/content_browser_client.h" | 33 #include "content/public/browser/content_browser_client.h" |
34 #include "content/public/browser/utility_process_host_client.h" | 34 #include "content/public/browser/utility_process_host_client.h" |
35 #include "content/public/common/content_switches.h" | 35 #include "content/public/common/content_switches.h" |
36 #include "content/public/common/mojo_channel_switches.h" | 36 #include "content/public/common/mojo_channel_switches.h" |
37 #include "content/public/common/mojo_shell_connection.h" | 37 #include "content/public/common/mojo_shell_connection.h" |
38 #include "content/public/common/process_type.h" | 38 #include "content/public/common/process_type.h" |
39 #include "content/public/common/sandbox_type.h" | 39 #include "content/public/common/sandbox_type.h" |
40 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 40 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 process_->GetHost()->CreateChannelMojo(); | 258 process_->GetHost()->CreateChannelMojo(); |
259 | 259 |
260 if (RenderProcessHost::run_renderer_in_process()) { | 260 if (RenderProcessHost::run_renderer_in_process()) { |
261 DCHECK(g_utility_main_thread_factory); | 261 DCHECK(g_utility_main_thread_factory); |
262 // See comment in RenderProcessHostImpl::Init() for the background on why we | 262 // See comment in RenderProcessHostImpl::Init() for the background on why we |
263 // support single process mode this way. | 263 // support single process mode this way. |
264 in_process_thread_.reset( | 264 in_process_thread_.reset( |
265 g_utility_main_thread_factory(InProcessChildThreadParams( | 265 g_utility_main_thread_factory(InProcessChildThreadParams( |
266 std::string(), BrowserThread::UnsafeGetMessageLoopForThread( | 266 std::string(), BrowserThread::UnsafeGetMessageLoopForThread( |
267 BrowserThread::IO)->task_runner(), | 267 BrowserThread::IO)->task_runner(), |
268 std::string(), | |
269 process_->child_connection()->service_token()))); | 268 process_->child_connection()->service_token()))); |
270 in_process_thread_->Start(); | 269 in_process_thread_->Start(); |
271 } else { | 270 } else { |
272 const base::CommandLine& browser_command_line = | 271 const base::CommandLine& browser_command_line = |
273 *base::CommandLine::ForCurrentProcess(); | 272 *base::CommandLine::ForCurrentProcess(); |
274 | 273 |
275 bool has_cmd_prefix = browser_command_line.HasSwitch( | 274 bool has_cmd_prefix = browser_command_line.HasSwitch( |
276 switches::kUtilityCmdPrefix); | 275 switches::kUtilityCmdPrefix); |
277 | 276 |
278 #if defined(OS_ANDROID) | 277 #if defined(OS_ANDROID) |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 base::WeakPtr<UtilityProcessHostImpl> host, | 401 base::WeakPtr<UtilityProcessHostImpl> host, |
403 int error_code) { | 402 int error_code) { |
404 if (!host) | 403 if (!host) |
405 return; | 404 return; |
406 | 405 |
407 host->OnProcessLaunchFailed(error_code); | 406 host->OnProcessLaunchFailed(error_code); |
408 delete host.get(); | 407 delete host.get(); |
409 } | 408 } |
410 | 409 |
411 } // namespace content | 410 } // namespace content |
OLD | NEW |