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" |
(...skipping 20 matching lines...) Expand all Loading... |
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" | 36 #include "content/public/common/mojo_shell_connection.h" |
37 #include "content/public/common/process_type.h" | 37 #include "content/public/common/process_type.h" |
38 #include "content/public/common/sandbox_type.h" | 38 #include "content/public/common/sandbox_type.h" |
39 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 39 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
40 #include "content/public/common/service_names.h" | 40 #include "content/public/common/service_names.h" |
41 #include "ipc/ipc_switches.h" | |
42 #include "mojo/edk/embedder/embedder.h" | 41 #include "mojo/edk/embedder/embedder.h" |
43 #include "services/shell/public/cpp/connection.h" | 42 #include "services/shell/public/cpp/connection.h" |
44 #include "services/shell/public/cpp/interface_provider.h" | 43 #include "services/shell/public/cpp/interface_provider.h" |
45 #include "ui/base/ui_base_switches.h" | 44 #include "ui/base/ui_base_switches.h" |
46 | 45 |
47 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 46 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
48 #include "content/public/browser/zygote_handle_linux.h" | 47 #include "content/public/browser/zygote_handle_linux.h" |
49 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 48 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
50 | 49 |
51 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 255 |
257 process_->SetName(name_); | 256 process_->SetName(name_); |
258 process_->GetHost()->CreateChannelMojo(); | 257 process_->GetHost()->CreateChannelMojo(); |
259 | 258 |
260 if (RenderProcessHost::run_renderer_in_process()) { | 259 if (RenderProcessHost::run_renderer_in_process()) { |
261 DCHECK(g_utility_main_thread_factory); | 260 DCHECK(g_utility_main_thread_factory); |
262 // See comment in RenderProcessHostImpl::Init() for the background on why we | 261 // See comment in RenderProcessHostImpl::Init() for the background on why we |
263 // support single process mode this way. | 262 // support single process mode this way. |
264 in_process_thread_.reset( | 263 in_process_thread_.reset( |
265 g_utility_main_thread_factory(InProcessChildThreadParams( | 264 g_utility_main_thread_factory(InProcessChildThreadParams( |
266 std::string(), BrowserThread::UnsafeGetMessageLoopForThread( | 265 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO) |
267 BrowserThread::IO)->task_runner(), | 266 ->task_runner(), |
268 process_->child_connection()->service_token()))); | 267 process_->child_connection()->service_token()))); |
269 in_process_thread_->Start(); | 268 in_process_thread_->Start(); |
270 } else { | 269 } else { |
271 const base::CommandLine& browser_command_line = | 270 const base::CommandLine& browser_command_line = |
272 *base::CommandLine::ForCurrentProcess(); | 271 *base::CommandLine::ForCurrentProcess(); |
273 | 272 |
274 bool has_cmd_prefix = browser_command_line.HasSwitch( | 273 bool has_cmd_prefix = browser_command_line.HasSwitch( |
275 switches::kUtilityCmdPrefix); | 274 switches::kUtilityCmdPrefix); |
276 | 275 |
277 #if defined(OS_ANDROID) | 276 #if defined(OS_ANDROID) |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 base::WeakPtr<UtilityProcessHostImpl> host, | 400 base::WeakPtr<UtilityProcessHostImpl> host, |
402 int error_code) { | 401 int error_code) { |
403 if (!host) | 402 if (!host) |
404 return; | 403 return; |
405 | 404 |
406 host->OnProcessLaunchFailed(error_code); | 405 host->OnProcessLaunchFailed(error_code); |
407 delete host.get(); | 406 delete host.get(); |
408 } | 407 } |
409 | 408 |
410 } // namespace content | 409 } // namespace content |
OLD | NEW |