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

Side by Side Diff: base/command_line.cc

Issue 2078913005: Add a chrome_elf_unittest ChromeElfLoadSanityTest which validates that loading chrome_elf does not … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove braces Created 4 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « base/command_line.h ('k') | base/message_loop/message_pump_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/command_line.h" 5 #include "base/command_line.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 CommandLine::~CommandLine() { 190 CommandLine::~CommandLine() {
191 } 191 }
192 192
193 #if defined(OS_WIN) 193 #if defined(OS_WIN)
194 // static 194 // static
195 void CommandLine::set_slash_is_not_a_switch() { 195 void CommandLine::set_slash_is_not_a_switch() {
196 // The last switch prefix should be slash, so adjust the size to skip it. 196 // The last switch prefix should be slash, so adjust the size to skip it.
197 DCHECK_EQ(wcscmp(kSwitchPrefixes[arraysize(kSwitchPrefixes) - 1], L"/"), 0); 197 DCHECK_EQ(wcscmp(kSwitchPrefixes[arraysize(kSwitchPrefixes) - 1], L"/"), 0);
198 switch_prefix_count = arraysize(kSwitchPrefixes) - 1; 198 switch_prefix_count = arraysize(kSwitchPrefixes) - 1;
199 } 199 }
200
201 // static
202 void CommandLine::InitUsingArgvForTesting(int argc, const char* const* argv) {
203 DCHECK(!current_process_commandline_);
204 current_process_commandline_ = new CommandLine(NO_PROGRAM);
205 // On Windows we need to convert the command line arguments to string16.
206 base::CommandLine::StringVector argv_vector;
207 for (int i = 0; i < argc; ++i)
208 argv_vector.push_back(UTF8ToUTF16(argv[i]));
209 current_process_commandline_->InitFromArgv(argv_vector);
210 }
200 #endif 211 #endif
201 212
202 // static 213 // static
203 bool CommandLine::Init(int argc, const char* const* argv) { 214 bool CommandLine::Init(int argc, const char* const* argv) {
204 if (current_process_commandline_) { 215 if (current_process_commandline_) {
205 // If this is intentional, Reset() must be called first. If we are using 216 // If this is intentional, Reset() must be called first. If we are using
206 // the shared build mode, we have to share a single object across multiple 217 // the shared build mode, we have to share a single object across multiple
207 // shared libraries. 218 // shared libraries.
208 return false; 219 return false;
209 } 220 }
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 return params; 484 return params;
474 } 485 }
475 486
476 void CommandLine::ResetStringPieces() { 487 void CommandLine::ResetStringPieces() {
477 switches_by_stringpiece_.clear(); 488 switches_by_stringpiece_.clear();
478 for (const auto& entry : switches_) 489 for (const auto& entry : switches_)
479 switches_by_stringpiece_[entry.first] = &(entry.second); 490 switches_by_stringpiece_[entry.first] = &(entry.second);
480 } 491 }
481 492
482 } // namespace base 493 } // namespace base
OLDNEW
« no previous file with comments | « base/command_line.h ('k') | base/message_loop/message_pump_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698