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

Unified Diff: base/command_line.h

Issue 1043803002: Use StringPiece for base CommandLine::HasSwitch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/command_line.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/command_line.h
diff --git a/base/command_line.h b/base/command_line.h
index 85d924a8d31dcf743507ceb518a1cddfb91579b7..8de490a7901ca890ce91c26798bd26413c2faa22 100644
--- a/base/command_line.h
+++ b/base/command_line.h
@@ -22,6 +22,7 @@
#include "base/base_export.h"
#include "base/strings/string16.h"
+#include "base/strings/string_piece.h"
#include "build/build_config.h"
namespace base {
@@ -143,7 +144,9 @@ class BASE_EXPORT CommandLine {
// Returns true if this command line contains the given switch.
// (Switch names are case-insensitive).
- bool HasSwitch(const std::string& switch_string) const;
+ // The second override provides an optimized version to avoid inlining the
+ // codegen for the string allocation.
+ bool HasSwitch(const base::StringPiece& switch_string) const;
// Returns the value associated with the given switch. If the switch has no
// value or isn't present, this method returns the empty string.
« no previous file with comments | « no previous file | base/command_line.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698