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

Side by Side Diff: base/command_line.cc

Issue 1007283012: Provide CommandLine::HasSwitch(const char*) to save 76kB in sizes perf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skip the case optimization Created 5 years, 9 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
« base/command_line.h ('K') | « base/command_line.h ('k') | no next file » | 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/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 259 }
260 260
261 void CommandLine::SetProgram(const FilePath& program) { 261 void CommandLine::SetProgram(const FilePath& program) {
262 TrimWhitespace(program.value(), TRIM_ALL, &argv_[0]); 262 TrimWhitespace(program.value(), TRIM_ALL, &argv_[0]);
263 } 263 }
264 264
265 bool CommandLine::HasSwitch(const std::string& switch_string) const { 265 bool CommandLine::HasSwitch(const std::string& switch_string) const {
266 return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end(); 266 return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end();
267 } 267 }
268 268
269 bool CommandLine::HasSwitch(const char string_constant[]) const {
270 return HasSwitch(std::string(string_constant));
271 }
272
269 std::string CommandLine::GetSwitchValueASCII( 273 std::string CommandLine::GetSwitchValueASCII(
270 const std::string& switch_string) const { 274 const std::string& switch_string) const {
271 StringType value = GetSwitchValueNative(switch_string); 275 StringType value = GetSwitchValueNative(switch_string);
272 if (!IsStringASCII(value)) { 276 if (!IsStringASCII(value)) {
273 DLOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII."; 277 DLOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII.";
274 return std::string(); 278 return std::string();
275 } 279 }
276 #if defined(OS_WIN) 280 #if defined(OS_WIN)
277 return UTF16ToASCII(value); 281 return UTF16ToASCII(value);
278 #else 282 #else
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 #if defined(OS_WIN) 446 #if defined(OS_WIN)
443 arg = QuoteForCommandLineToArgvW(arg, quote_placeholders); 447 arg = QuoteForCommandLineToArgvW(arg, quote_placeholders);
444 #endif 448 #endif
445 params.append(arg); 449 params.append(arg);
446 } 450 }
447 } 451 }
448 return params; 452 return params;
449 } 453 }
450 454
451 } // namespace base 455 } // namespace base
OLDNEW
« base/command_line.h ('K') | « base/command_line.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698