Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: chrome/app/mash/mash_runner.cc

Issue 2545633002: Tolerate more than one copy of the --mash command line switch (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/mash/mash_runner.cc
diff --git a/chrome/app/mash/mash_runner.cc b/chrome/app/mash/mash_runner.cc
index b9a99a60bcea18b43f562bfa9dc8dbf45b0dd18d..c1beac625d964fa0d42e180e82694eba360b796d 100644
--- a/chrome/app/mash/mash_runner.cc
+++ b/chrome/app/mash/mash_runner.cc
@@ -105,12 +105,13 @@ class NativeRunnerDelegateImpl : public service_manager::NativeRunnerDelegate {
// When launching the browser process, ensure that we don't inherit the
// --mash flag so it proceeds with the normal content/browser startup path.
- base::CommandLine::StringVector argv(command_line->argv());
- auto iter =
- std::find(argv.begin(), argv.end(), FILE_PATH_LITERAL("--mash"));
- if (iter != argv.end())
- argv.erase(iter);
- *command_line = base::CommandLine(argv);
+ // Eliminate all copies in case the developer passed more than one.
+ base::CommandLine::StringVector new_argv;
+ for (const base::CommandLine::StringType& arg : command_line->argv()) {
+ if (arg != FILE_PATH_LITERAL("--mash"))
+ new_argv.push_back(arg);
+ }
+ *command_line = base::CommandLine(new_argv);
}
DISALLOW_COPY_AND_ASSIGN(NativeRunnerDelegateImpl);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698