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

Unified Diff: base/feature_list.h

Issue 1484483002: Plumb base::Feature field trial association to renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ownz
Patch Set: Address nits. Created 5 years, 1 month 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/feature_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/feature_list.h
diff --git a/base/feature_list.h b/base/feature_list.h
index 5091a330ad55bcbc5e5f53e86216716306c06f5d..39672632b0db26e65871433a984481751571329b 100644
--- a/base/feature_list.h
+++ b/base/feature_list.h
@@ -13,6 +13,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/strings/string_piece.h"
#include "base/synchronization/lock.h"
namespace base {
@@ -81,8 +82,10 @@ class BASE_EXPORT FeatureList {
// Initializes feature overrides via command-line flags |enable_features| and
// |disable_features|, each of which is a comma-separated list of features to
// enable or disable, respectively. If a feature appears on both lists, then
- // it will be disabled. Must only be invoked during the initialization phase
- // (before FinalizeInitialization() has been called).
+ // it will be disabled. If a list entry has the format "FeatureName<TrialName"
+ // then this initialization will also associate the feature state override
+ // with the named field trial, if it exists. Must only be invoked during the
+ // initialization phase (before FinalizeInitialization() has been called).
void InitializeFromCommandLine(const std::string& enable_features,
const std::string& disable_features);
@@ -119,8 +122,11 @@ class BASE_EXPORT FeatureList {
// Returns comma-separated lists of feature names (in the same format that is
// accepted by InitializeFromCommandLine()) corresponding to features that
- // have been overridden - either through command-line or via FieldTrials.
- // Must be called only after the instance has been initialized and registered.
+ // have been overridden - either through command-line or via FieldTrials. For
+ // those features that have an associated FieldTrial, the output entry will be
+ // of the format "FeatureName<TrialName", where "TrialName" is the name of the
+ // FieldTrial. Must be called only after the instance has been initialized and
+ // registered.
void GetFeatureOverrides(std::string* enable_overrides,
std::string* disable_overrides);
@@ -185,6 +191,13 @@ class BASE_EXPORT FeatureList {
// Requires the FeatureList to have already been fully initialized.
bool IsFeatureEnabled(const Feature& feature);
+ // For each feature name in comma-separated list of strings |feature_list|,
+ // registers an override with the specified |overridden_state|. Also, will
+ // associate an optional named field trial if the entry is of the format
+ // "FeatureName<TrialName".
+ void RegisterOverridesFromCommandLine(const std::string& feature_list,
+ OverrideState overridden_state);
+
// Registers an override for feature |feature_name|. The override specifies
// whether the feature should be on or off (via |overridden_state|), which
// will take precedence over the feature's default state. If |field_trial| is
@@ -192,7 +205,7 @@ class BASE_EXPORT FeatureList {
// the feature, which will activate the field trial when the feature state is
// queried. If an override is already registered for the given feature, it
// will not be changed.
- void RegisterOverride(const std::string& feature_name,
+ void RegisterOverride(StringPiece feature_name,
OverrideState overridden_state,
FieldTrial* field_trial);
« no previous file with comments | « no previous file | base/feature_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698