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

Unified Diff: base/feature_list.cc

Issue 1941963002: Add variations params api to get params from features. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 da5efe0aaf78eb0d984d104e72e3686718b2c1da..46732108dd6fcf0004e14b7ad6da06faf3561718 100644
--- a/base/feature_list.cc
+++ b/base/feature_list.cc
@@ -137,6 +137,11 @@ bool FeatureList::IsEnabled(const Feature& feature) {
}
// static
+FieldTrial* FeatureList::GetFieldTrial(const Feature& feature) {
+ return GetInstance()->GetAssociatedFieldTrial(feature);
+}
+
+// static
std::vector<std::string> FeatureList::SplitFeatureListString(
const std::string& input) {
return SplitString(input, ",", TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY);
@@ -217,6 +222,20 @@ bool FeatureList::IsFeatureEnabled(const Feature& feature) {
return feature.default_state == FEATURE_ENABLED_BY_DEFAULT;
}
+FieldTrial* FeatureList::GetAssociatedFieldTrial(const Feature& feature) {
+ DCHECK(initialized_);
+ DCHECK(IsValidFeatureOrFieldTrialName(feature.name)) << feature.name;
+ DCHECK(CheckFeatureIdentity(feature)) << feature.name;
+
+ auto it = overrides_.find(feature.name);
+ if (it != overrides_.end()) {
+ const OverrideEntry& entry = it->second;
+ return entry.field_trial;
+ }
+
+ return nullptr;
+}
+
void FeatureList::RegisterOverridesFromCommandLine(
const std::string& feature_list,
OverrideState overridden_state) {
« 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