Lines Matching refs:Feature
23 // Specifies whether a given feature is enabled or disabled by default.
29 // The Feature struct is used to define the default state for a feature. See
31 // for a given feature name - generally defined as a constant global variable or
33 struct BASE_EXPORT Feature {
34 // The name of the feature. This should be unique to each feature and is used
38 // The default state (i.e. enabled or disabled) for this feature.
42 // The FeatureList class is used to determine whether a given feature is on or
46 // The basic use case is for any feature that can be toggled (e.g. through
47 // command-line or an experiment) to have a defined Feature struct, e.g.:
49 // const base::Feature kMyGreatFeature {
53 // Then, client code that wishes to query the state of the feature would check:
56 // // Feature code goes here.
60 // flags to enable or disable the feature, any experiments that may control it
62 // whether the feature is on.
65 // separated feature names via the following command-line flags:
82 // Initializes feature overrides via command-line flags |enable_features| and
84 // enable or disable, respectively. If a feature appears on both lists, then
86 // then this initialization will also associate the feature state override
87 // with the named field trial, if it exists. If a feature name is prefixed
95 // Specifies whether a feature override enables or disables the feature.
108 // command-line setting the feature state to |for_overridden_state|. The trial
109 // will be activated when the state of the feature is first queried. This
117 // feature to |override_state|. Command-line overrides still take precedence
118 // over field trials, so this will have no effect if the feature is being
120 // activated when the feature state for this feature is queried. This should
127 // Returns comma-separated lists of feature names (in the same format that is
138 // Returns whether the given |feature| is enabled. Must only be called after
140 // a feature with a given name must only have a single corresponding Feature
142 static bool IsEnabled(const Feature& feature);
144 // Returns the field trial associated with the given |feature|. Must only be
146 static FieldTrial* GetFieldTrial(const Feature& feature);
148 // Splits a comma-separated string containing feature names into a vector.
152 // Initializes and sets an instance of FeatureList with feature overrides via
164 // Registers the given |instance| to be the singleton feature list for this
175 // The overridden enable (on/off) state of the feature.
179 // state of the feature is queried for the first time. Weak pointer to the
183 // Specifies whether the feature's state is overridden by |field_trial|.
199 // singleton feature list that is being registered.
202 // Returns whether the given |feature| is enabled. This is invoked by the
205 bool IsFeatureEnabled(const Feature& feature);
207 // Returns the field trial associated with the given |feature|. This is
211 base::FieldTrial* GetAssociatedFieldTrial(const Feature& feature);
213 // For each feature name in comma-separated list of strings |feature_list|,
220 // Registers an override for feature |feature_name|. The override specifies
221 // whether the feature should be on or off (via |overridden_state|), which
222 // will take precedence over the feature's default state. If |field_trial| is
224 // the feature, which will activate the field trial when the feature state is
225 // queried. If an override is already registered for the given feature, it
231 // Verifies that there's only a single definition of a Feature struct for a
232 // given feature name. Keeps track of the first seen Feature struct for each
233 // feature. Returns false when called on a Feature struct with a different
234 // address than the first one it saw for that feature name. Used only from
236 bool CheckFeatureIdentity(const Feature& feature);
238 // Map from feature name to an OverrideEntry struct for the feature, if it
242 // Locked map that keeps track of seen features, to ensure a single feature is
246 std::map<std::string, const Feature*> feature_identity_tracker_;