Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/app/mash/mash_runner.h" | 5 #include "chrome/app/mash/mash_runner.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 22 #include "base/process/launch.h" | 22 #include "base/process/launch.h" |
| 23 #include "base/process/process.h" | 23 #include "base/process/process.h" |
| 24 #include "base/run_loop.h" | 24 #include "base/run_loop.h" |
| 25 #include "base/sys_info.h" | 25 #include "base/sys_info.h" |
| 26 #include "base/task_scheduler/task_scheduler.h" | 26 #include "base/task_scheduler/task_scheduler.h" |
| 27 #include "base/threading/sequenced_worker_pool.h" | 27 #include "base/threading/sequenced_worker_pool.h" |
| 28 #include "base/threading/thread.h" | 28 #include "base/threading/thread.h" |
| 29 #include "base/trace_event/trace_event.h" | 29 #include "base/trace_event/trace_event.h" |
| 30 #include "chrome/app/mash/chrome_mash_catalog.h" | 30 #include "chrome/app/mash/chrome_mash_catalog.h" |
| 31 #include "chrome/common/chrome_switches.h" | |
| 31 #include "components/tracing/common/trace_to_console.h" | 32 #include "components/tracing/common/trace_to_console.h" |
| 32 #include "components/tracing/common/tracing_switches.h" | 33 #include "components/tracing/common/tracing_switches.h" |
| 33 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
| 34 #include "content/public/common/service_names.mojom.h" | 35 #include "content/public/common/service_names.mojom.h" |
| 35 #include "mash/common/config.h" | 36 #include "mash/common/config.h" |
| 36 #include "mash/package/mash_packaged_service.h" | 37 #include "mash/package/mash_packaged_service.h" |
| 37 #include "mash/quick_launch/public/interfaces/constants.mojom.h" | 38 #include "mash/quick_launch/public/interfaces/constants.mojom.h" |
| 38 #include "mojo/edk/embedder/embedder.h" | 39 #include "mojo/edk/embedder/embedder.h" |
| 39 #include "mojo/edk/embedder/scoped_ipc_support.h" | 40 #include "mojo/edk/embedder/scoped_ipc_support.h" |
| 40 #include "mojo/public/cpp/bindings/binding_set.h" | 41 #include "mojo/public/cpp/bindings/binding_set.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 // child process. The new process will execute MashRunner::RunChild(). | 110 // child process. The new process will execute MashRunner::RunChild(). |
| 110 command_line->AppendSwitchASCII(switches::kProcessType, kMashChild); | 111 command_line->AppendSwitchASCII(switches::kProcessType, kMashChild); |
| 111 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
| 112 command_line->AppendArg(switches::kPrefetchArgumentOther); | 113 command_line->AppendArg(switches::kPrefetchArgumentOther); |
| 113 #endif | 114 #endif |
| 114 return; | 115 return; |
| 115 } | 116 } |
| 116 | 117 |
| 117 // When launching the browser process, ensure that we don't inherit the | 118 // When launching the browser process, ensure that we don't inherit the |
| 118 // --mash flag so it proceeds with the normal content/browser startup path. | 119 // --mash flag so it proceeds with the normal content/browser startup path. |
| 119 // Eliminate all copies in case the developer passed more than one. | 120 base::CommandLine::SwitchMap new_switches = command_line->GetSwitches(); |
| 120 base::CommandLine::StringVector new_argv; | 121 new_switches.erase(switches::kMash); |
| 121 for (const base::CommandLine::StringType& arg : command_line->argv()) { | 122 *command_line = base::CommandLine(command_line->GetProgram()); |
| 122 if (arg != FILE_PATH_LITERAL("--mash")) | 123 for (const auto sw : new_switches) |
|
James Cook
2017/02/08 19:19:51
can this be const auto& ?
I'm not sure about our
mfomitchev
2017/02/08 20:39:23
Done.
| |
| 123 new_argv.push_back(arg); | 124 command_line->AppendSwitchNative(sw.first, sw.second); |
| 124 } | |
| 125 *command_line = base::CommandLine(new_argv); | |
| 126 } | 125 } |
| 127 | 126 |
| 128 DISALLOW_COPY_AND_ASSIGN(ServiceProcessLauncherDelegateImpl); | 127 DISALLOW_COPY_AND_ASSIGN(ServiceProcessLauncherDelegateImpl); |
| 129 }; | 128 }; |
| 130 | 129 |
| 131 #if defined(OS_CHROMEOS) | 130 #if defined(OS_CHROMEOS) |
| 132 // Initializes breakpad crash reporting. MashCrashReporterClient handles | 131 // Initializes breakpad crash reporting. MashCrashReporterClient handles |
| 133 // registering crash keys. | 132 // registering crash keys. |
| 134 void InitializeCrashReporting() { | 133 void InitializeCrashReporting() { |
| 135 DCHECK(!breakpad::IsCrashReporterEnabled()); | 134 DCHECK(!breakpad::IsCrashReporterEnabled()); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) { | 314 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) { |
| 316 return; | 315 return; |
| 317 } | 316 } |
| 318 | 317 |
| 319 // Include the pid as logging may not have been initialized yet (the pid | 318 // Include the pid as logging may not have been initialized yet (the pid |
| 320 // printed out by logging is wrong). | 319 // printed out by logging is wrong). |
| 321 LOG(WARNING) << "waiting for debugger to attach for service " << service_name | 320 LOG(WARNING) << "waiting for debugger to attach for service " << service_name |
| 322 << " pid=" << base::Process::Current().Pid(); | 321 << " pid=" << base::Process::Current().Pid(); |
| 323 base::debug::WaitForDebugger(120, true); | 322 base::debug::WaitForDebugger(120, true); |
| 324 } | 323 } |
| OLD | NEW |