| 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/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/process/process_handle.h" | 18 #include "base/process/process_handle.h" |
| 19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 20 #include "base/sequenced_task_runner.h" | 20 #include "base/sequenced_task_runner.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
| 23 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "components/network_session_configurator/common/network_switches.h" |
| 25 #include "content/browser/browser_child_process_host_impl.h" | 26 #include "content/browser/browser_child_process_host_impl.h" |
| 26 #include "content/browser/renderer_host/render_process_host_impl.h" | 27 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 27 #include "content/browser/service_manager/service_manager_context.h" | 28 #include "content/browser/service_manager/service_manager_context.h" |
| 28 #include "content/common/child_process_host_impl.h" | 29 #include "content/common/child_process_host_impl.h" |
| 29 #include "content/common/in_process_child_thread_params.h" | 30 #include "content/common/in_process_child_thread_params.h" |
| 30 #include "content/common/service_manager/child_connection.h" | 31 #include "content/common/service_manager/child_connection.h" |
| 31 #include "content/common/utility_messages.h" | 32 #include "content/common/utility_messages.h" |
| 32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/content_browser_client.h" | 34 #include "content/public/browser/content_browser_client.h" |
| 34 #include "content/public/browser/utility_process_host_client.h" | 35 #include "content/public/browser/utility_process_host_client.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 cmd_line->AppendArg(switches::kPrefetchArgumentOther); | 297 cmd_line->AppendArg(switches::kPrefetchArgumentOther); |
| 297 #endif // defined(OS_WIN) | 298 #endif // defined(OS_WIN) |
| 298 | 299 |
| 299 if (no_sandbox_) | 300 if (no_sandbox_) |
| 300 cmd_line->AppendSwitch(switches::kNoSandbox); | 301 cmd_line->AppendSwitch(switches::kNoSandbox); |
| 301 | 302 |
| 302 // Browser command-line switches to propagate to the utility process. | 303 // Browser command-line switches to propagate to the utility process. |
| 303 static const char* const kSwitchNames[] = { | 304 static const char* const kSwitchNames[] = { |
| 304 switches::kEnableNetworkService, | 305 switches::kEnableNetworkService, |
| 305 switches::kHostResolverRules, | 306 switches::kHostResolverRules, |
| 306 switches::kIgnoreCertificateErrors, | |
| 307 switches::kLogNetLog, | 307 switches::kLogNetLog, |
| 308 switches::kNoSandbox, | 308 switches::kNoSandbox, |
| 309 switches::kProfilerTiming, | 309 switches::kProfilerTiming, |
| 310 switches::kProxyServer, | 310 switches::kProxyServer, |
| 311 switches::kTestingFixedHttpPort, | |
| 312 switches::kTestingFixedHttpsPort, | |
| 313 #if defined(OS_MACOSX) | 311 #if defined(OS_MACOSX) |
| 314 switches::kEnableSandboxLogging, | 312 switches::kEnableSandboxLogging, |
| 315 #endif | 313 #endif |
| 316 switches::kUseFakeDeviceForMediaStream, | 314 switches::kUseFakeDeviceForMediaStream, |
| 317 switches::kUseFileForFakeVideoCapture, | 315 switches::kUseFileForFakeVideoCapture, |
| 318 }; | 316 }; |
| 319 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, | 317 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| 320 arraysize(kSwitchNames)); | 318 arraysize(kSwitchNames)); |
| 321 | 319 |
| 320 network_session_configurator::CopyNetworkSwitches(browser_command_line, |
| 321 cmd_line.get()); |
| 322 |
| 322 if (has_cmd_prefix) { | 323 if (has_cmd_prefix) { |
| 323 // Launch the utility child process with some prefix | 324 // Launch the utility child process with some prefix |
| 324 // (usually "xterm -e gdb --args"). | 325 // (usually "xterm -e gdb --args"). |
| 325 cmd_line->PrependWrapper(browser_command_line.GetSwitchValueNative( | 326 cmd_line->PrependWrapper(browser_command_line.GetSwitchValueNative( |
| 326 switches::kUtilityCmdPrefix)); | 327 switches::kUtilityCmdPrefix)); |
| 327 } | 328 } |
| 328 | 329 |
| 329 if (!exposed_dir_.empty()) { | 330 if (!exposed_dir_.empty()) { |
| 330 cmd_line->AppendSwitchPath(switches::kUtilityProcessAllowedDir, | 331 cmd_line->AppendSwitchPath(switches::kUtilityProcessAllowedDir, |
| 331 exposed_dir_); | 332 exposed_dir_); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 base::WeakPtr<UtilityProcessHostImpl> host, | 394 base::WeakPtr<UtilityProcessHostImpl> host, |
| 394 int error_code) { | 395 int error_code) { |
| 395 if (!host) | 396 if (!host) |
| 396 return; | 397 return; |
| 397 | 398 |
| 398 host->OnProcessLaunchFailed(error_code); | 399 host->OnProcessLaunchFailed(error_code); |
| 399 delete host.get(); | 400 delete host.get(); |
| 400 } | 401 } |
| 401 | 402 |
| 402 } // namespace content | 403 } // namespace content |
| OLD | NEW |