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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 276 } |
277 | 277 |
278 if (RenderProcessHost::run_renderer_in_process()) { | 278 if (RenderProcessHost::run_renderer_in_process()) { |
279 DCHECK(g_utility_main_thread_factory); | 279 DCHECK(g_utility_main_thread_factory); |
280 // See comment in RenderProcessHostImpl::Init() for the background on why we | 280 // See comment in RenderProcessHostImpl::Init() for the background on why we |
281 // support single process mode this way. | 281 // support single process mode this way. |
282 in_process_thread_.reset( | 282 in_process_thread_.reset( |
283 g_utility_main_thread_factory(InProcessChildThreadParams( | 283 g_utility_main_thread_factory(InProcessChildThreadParams( |
284 std::string(), BrowserThread::UnsafeGetMessageLoopForThread( | 284 std::string(), BrowserThread::UnsafeGetMessageLoopForThread( |
285 BrowserThread::IO)->task_runner(), | 285 BrowserThread::IO)->task_runner(), |
286 mojo_channel_token, mojo_child_connection_->shell_client_token()))); | 286 mojo_channel_token, mojo_child_connection_->service_token()))); |
287 in_process_thread_->Start(); | 287 in_process_thread_->Start(); |
288 } else { | 288 } else { |
289 const base::CommandLine& browser_command_line = | 289 const base::CommandLine& browser_command_line = |
290 *base::CommandLine::ForCurrentProcess(); | 290 *base::CommandLine::ForCurrentProcess(); |
291 | 291 |
292 bool has_cmd_prefix = browser_command_line.HasSwitch( | 292 bool has_cmd_prefix = browser_command_line.HasSwitch( |
293 switches::kUtilityCmdPrefix); | 293 switches::kUtilityCmdPrefix); |
294 | 294 |
295 #if defined(OS_ANDROID) | 295 #if defined(OS_ANDROID) |
296 // readlink("/prof/self/exe") sometimes fails on Android at startup. | 296 // readlink("/prof/self/exe") sometimes fails on Android at startup. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 exposed_dir_); | 355 exposed_dir_); |
356 } | 356 } |
357 | 357 |
358 #if defined(OS_WIN) | 358 #if defined(OS_WIN) |
359 // Let the utility process know if it is intended to be elevated. | 359 // Let the utility process know if it is intended to be elevated. |
360 if (run_elevated_) | 360 if (run_elevated_) |
361 cmd_line->AppendSwitch(switches::kUtilityProcessRunningElevated); | 361 cmd_line->AppendSwitch(switches::kUtilityProcessRunningElevated); |
362 #endif | 362 #endif |
363 | 363 |
364 cmd_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, | 364 cmd_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, |
365 mojo_child_connection_->shell_client_token()); | 365 mojo_child_connection_->service_token()); |
366 | 366 |
367 process_->Launch( | 367 process_->Launch( |
368 new UtilitySandboxedProcessLauncherDelegate(exposed_dir_, | 368 new UtilitySandboxedProcessLauncherDelegate(exposed_dir_, |
369 run_elevated_, | 369 run_elevated_, |
370 no_sandbox_, env_, | 370 no_sandbox_, env_, |
371 process_->GetHost()), | 371 process_->GetHost()), |
372 cmd_line, | 372 cmd_line, |
373 true); | 373 true); |
374 } | 374 } |
375 | 375 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 base::WeakPtr<UtilityProcessHostImpl> host, | 424 base::WeakPtr<UtilityProcessHostImpl> host, |
425 int error_code) { | 425 int error_code) { |
426 if (!host) | 426 if (!host) |
427 return; | 427 return; |
428 | 428 |
429 host->OnProcessLaunchFailed(error_code); | 429 host->OnProcessLaunchFailed(error_code); |
430 delete host.get(); | 430 delete host.get(); |
431 } | 431 } |
432 | 432 |
433 } // namespace content | 433 } // namespace content |
OLD | NEW |