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

Unified Diff: base/feature_list.cc

Issue 1824753002: Plumb trial association without overriding a feature to subprocesses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « base/feature_list.h ('k') | base/feature_list_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/feature_list.cc
diff --git a/base/feature_list.cc b/base/feature_list.cc
index 089da644e061cd7ac1b3945ab2791f3ccc84f333..853fc4d84e6df24f8c195b0e59c44aad8bc6e721 100644
--- a/base/feature_list.cc
+++ b/base/feature_list.cc
@@ -30,7 +30,7 @@ FeatureList* g_instance = nullptr;
// are any reserved characters present, returning true if the string is valid.
// Only called in DCHECKs.
bool IsValidFeatureOrFieldTrialName(const std::string& name) {
- return IsStringASCII(name) && name.find_first_of(",<") == std::string::npos;
+ return IsStringASCII(name) && name.find_first_of(",<*") == std::string::npos;
}
} // namespace
@@ -99,21 +99,25 @@ void FeatureList::GetFeatureOverrides(std::string* enable_overrides,
enable_overrides->clear();
disable_overrides->clear();
+ // Note: Since |overrides_| is a std::map, iteration will be in alphabetical
+ // order. This not guaranteed to users of this function, but is useful for
+ // tests to assume the order.
for (const auto& entry : overrides_) {
std::string* target_list = nullptr;
switch (entry.second.overridden_state) {
+ case OVERRIDE_USE_DEFAULT:
case OVERRIDE_ENABLE_FEATURE:
target_list = enable_overrides;
break;
case OVERRIDE_DISABLE_FEATURE:
target_list = disable_overrides;
break;
- case OVERRIDE_USE_DEFAULT:
- continue;
}
if (!target_list->empty())
target_list->push_back(',');
+ if (entry.second.overridden_state == OVERRIDE_USE_DEFAULT)
+ target_list->push_back('*');
target_list->append(entry.first);
if (entry.second.field_trial) {
target_list->push_back('<');
@@ -215,6 +219,10 @@ void FeatureList::RegisterOverride(StringPiece feature_name,
DCHECK(IsValidFeatureOrFieldTrialName(field_trial->trial_name()))
<< field_trial->trial_name();
}
+ if (feature_name.starts_with("*")) {
+ feature_name = feature_name.substr(1);
+ overridden_state = OVERRIDE_USE_DEFAULT;
+ }
// Note: The semantics of insert() is that it does not overwrite the entry if
// one already exists for the key. Thus, only the first override for a given
« no previous file with comments | « base/feature_list.h ('k') | base/feature_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698