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

Unified Diff: base/feature_list.cc

Issue 2695883003: Change uses of base::JoinString to pass StringPieces where possible. (Closed)
Patch Set: Fix android_webview compilation (and made FeatureList::SplitFeatureListString take StringPiece). Created 3 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
Index: base/feature_list.cc
diff --git a/base/feature_list.cc b/base/feature_list.cc
index 353136c12be5c73516c5c89a644558a60fba336b..8dbde97eb4b2c356ac1aad0055e7230a77fced18 100644
--- a/base/feature_list.cc
+++ b/base/feature_list.cc
@@ -228,9 +228,9 @@ FieldTrial* FeatureList::GetFieldTrial(const Feature& feature) {
}
// static
-std::vector<std::string> FeatureList::SplitFeatureListString(
- const std::string& input) {
- return SplitString(input, ",", TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY);
+std::vector<base::StringPiece> FeatureList::SplitFeatureListString(
+ base::StringPiece input) {
+ return SplitStringPiece(input, ",", TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY);
}
// static
@@ -339,8 +339,8 @@ FieldTrial* FeatureList::GetAssociatedFieldTrial(const Feature& feature) {
void FeatureList::RegisterOverridesFromCommandLine(
const std::string& feature_list,
OverrideState overridden_state) {
- for (const auto& value : SplitFeatureListString(feature_list)) {
- StringPiece feature_name(value);
+ for (auto value : SplitFeatureListString(feature_list)) {
dcheng 2017/03/15 10:02:36 Hmmm... StringPiece are pretty cheap, but I suspec
Matt Giuca 2017/03/17 00:16:27 I'm just going by the summary at the top of string
dcheng 2017/03/17 05:28:34 Mind pasting the assembly somewhere? (I know it's
Matt Giuca 2017/03/21 08:28:48 OK I did a deeper analysis. I'm not sure about the
Matt Giuca 2017/03/27 03:24:58 After an extensive analysis, my conclusion was tha
+ StringPiece feature_name = value;
base::FieldTrial* trial = nullptr;
// The entry may be of the form FeatureName<FieldTrialName - in which case,
@@ -348,7 +348,7 @@ void FeatureList::RegisterOverridesFromCommandLine(
std::string::size_type pos = feature_name.find('<');
if (pos != std::string::npos) {
feature_name.set(value.data(), pos);
- trial = base::FieldTrialList::Find(value.substr(pos + 1));
+ trial = base::FieldTrialList::Find(value.substr(pos + 1).as_string());
}
RegisterOverride(feature_name, overridden_state, trial);

Powered by Google App Engine
This is Rietveld 408576698