| 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 "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // child process. The new process will execute MashRunner::RunChild(). | 98 // child process. The new process will execute MashRunner::RunChild(). |
| 99 command_line->AppendSwitchASCII(switches::kProcessType, kMashChild); | 99 command_line->AppendSwitchASCII(switches::kProcessType, kMashChild); |
| 100 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
| 101 command_line->AppendArg(switches::kPrefetchArgumentOther); | 101 command_line->AppendArg(switches::kPrefetchArgumentOther); |
| 102 #endif | 102 #endif |
| 103 return; | 103 return; |
| 104 } | 104 } |
| 105 | 105 |
| 106 // When launching the browser process, ensure that we don't inherit the | 106 // When launching the browser process, ensure that we don't inherit the |
| 107 // --mash flag so it proceeds with the normal content/browser startup path. | 107 // --mash flag so it proceeds with the normal content/browser startup path. |
| 108 base::CommandLine::StringVector argv(command_line->argv()); | 108 // Eliminate all copies in case the developer passed more than one. |
| 109 auto iter = | 109 base::CommandLine::StringVector new_argv; |
| 110 std::find(argv.begin(), argv.end(), FILE_PATH_LITERAL("--mash")); | 110 for (const base::CommandLine::StringType& arg : command_line->argv()) { |
| 111 if (iter != argv.end()) | 111 if (arg != FILE_PATH_LITERAL("--mash")) |
| 112 argv.erase(iter); | 112 new_argv.push_back(arg); |
| 113 *command_line = base::CommandLine(argv); | 113 } |
| 114 *command_line = base::CommandLine(new_argv); |
| 114 } | 115 } |
| 115 | 116 |
| 116 DISALLOW_COPY_AND_ASSIGN(NativeRunnerDelegateImpl); | 117 DISALLOW_COPY_AND_ASSIGN(NativeRunnerDelegateImpl); |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 } // namespace | 120 } // namespace |
| 120 | 121 |
| 121 MashRunner::MashRunner() {} | 122 MashRunner::MashRunner() {} |
| 122 | 123 |
| 123 MashRunner::~MashRunner() {} | 124 MashRunner::~MashRunner() {} |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 base::trace_event::TraceConfig trace_config = | 233 base::trace_event::TraceConfig trace_config = |
| 233 tracing::GetConfigForTraceToConsole(); | 234 tracing::GetConfigForTraceToConsole(); |
| 234 base::trace_event::TraceLog::GetInstance()->SetEnabled( | 235 base::trace_event::TraceLog::GetInstance()->SetEnabled( |
| 235 trace_config, | 236 trace_config, |
| 236 base::trace_event::TraceLog::RECORDING_MODE); | 237 base::trace_event::TraceLog::RECORDING_MODE); |
| 237 } | 238 } |
| 238 | 239 |
| 239 MashRunner mash_runner; | 240 MashRunner mash_runner; |
| 240 return mash_runner.Run(); | 241 return mash_runner.Run(); |
| 241 } | 242 } |
| OLD | NEW |