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/renderer_host/render_process_host_impl.h" | 25 #include "content/browser/renderer_host/render_process_host_impl.h" |
26 #include "content/browser/service_manager/service_manager_context.h" | 26 #include "content/browser/service_manager/service_manager_context.h" |
27 #include "content/common/child_process_host_impl.h" | 27 #include "content/common/child_process_host_impl.h" |
28 #include "content/common/in_process_child_thread_params.h" | 28 #include "content/common/in_process_child_thread_params.h" |
29 #include "content/common/mojo/mojo_child_connection.h" | 29 #include "content/common/service_manager/child_connection.h" |
30 #include "content/common/utility_messages.h" | 30 #include "content/common/utility_messages.h" |
31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
32 #include "content/public/browser/content_browser_client.h" | 32 #include "content/public/browser/content_browser_client.h" |
33 #include "content/public/browser/utility_process_host_client.h" | 33 #include "content/public/browser/utility_process_host_client.h" |
34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
35 #include "content/public/common/mojo_channel_switches.h" | 35 #include "content/public/common/mojo_channel_switches.h" |
36 #include "content/public/common/mojo_shell_connection.h" | |
37 #include "content/public/common/process_type.h" | 36 #include "content/public/common/process_type.h" |
38 #include "content/public/common/sandbox_type.h" | 37 #include "content/public/common/sandbox_type.h" |
39 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 38 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 39 #include "content/public/common/service_manager_connection.h" |
40 #include "content/public/common/service_names.h" | 40 #include "content/public/common/service_names.h" |
41 #include "mojo/edk/embedder/embedder.h" | 41 #include "mojo/edk/embedder/embedder.h" |
42 #include "services/shell/public/cpp/connection.h" | 42 #include "services/shell/public/cpp/connection.h" |
43 #include "services/shell/public/cpp/interface_provider.h" | 43 #include "services/shell/public/cpp/interface_provider.h" |
44 #include "ui/base/ui_base_switches.h" | 44 #include "ui/base/ui_base_switches.h" |
45 | 45 |
46 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 46 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
47 #include "content/public/browser/zygote_handle_linux.h" | 47 #include "content/public/browser/zygote_handle_linux.h" |
48 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 48 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
49 | 49 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 run_elevated_(false), | 158 run_elevated_(false), |
159 #if defined(OS_LINUX) | 159 #if defined(OS_LINUX) |
160 child_flags_(ChildProcessHost::CHILD_ALLOW_SELF), | 160 child_flags_(ChildProcessHost::CHILD_ALLOW_SELF), |
161 #else | 161 #else |
162 child_flags_(ChildProcessHost::CHILD_NORMAL), | 162 child_flags_(ChildProcessHost::CHILD_NORMAL), |
163 #endif | 163 #endif |
164 started_(false), | 164 started_(false), |
165 name_(base::ASCIIToUTF16("utility process")), | 165 name_(base::ASCIIToUTF16("utility process")), |
166 weak_ptr_factory_(this) { | 166 weak_ptr_factory_(this) { |
167 process_.reset(new BrowserChildProcessHostImpl( | 167 process_.reset(new BrowserChildProcessHostImpl( |
168 PROCESS_TYPE_UTILITY, this, kUtilityMojoApplicationName)); | 168 PROCESS_TYPE_UTILITY, this, kUtilityServiceName)); |
169 } | 169 } |
170 | 170 |
171 UtilityProcessHostImpl::~UtilityProcessHostImpl() { | 171 UtilityProcessHostImpl::~UtilityProcessHostImpl() { |
172 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 172 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
173 if (is_batch_mode_) | 173 if (is_batch_mode_) |
174 EndBatchMode(); | 174 EndBatchMode(); |
175 } | 175 } |
176 | 176 |
177 base::WeakPtr<UtilityProcessHost> UtilityProcessHostImpl::AsWeakPtr() { | 177 base::WeakPtr<UtilityProcessHost> UtilityProcessHostImpl::AsWeakPtr() { |
178 return weak_ptr_factory_.GetWeakPtr(); | 178 return weak_ptr_factory_.GetWeakPtr(); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 base::WeakPtr<UtilityProcessHostImpl> host, | 400 base::WeakPtr<UtilityProcessHostImpl> host, |
401 int error_code) { | 401 int error_code) { |
402 if (!host) | 402 if (!host) |
403 return; | 403 return; |
404 | 404 |
405 host->OnProcessLaunchFailed(error_code); | 405 host->OnProcessLaunchFailed(error_code); |
406 delete host.get(); | 406 delete host.get(); |
407 } | 407 } |
408 | 408 |
409 } // namespace content | 409 } // namespace content |
OLD | NEW |