Home | History | Annotate | Download | only in base

Lines Matching refs:Feature

24 // Specifies whether a given feature is enabled or disabled by default.
30 // The Feature struct is used to define the default state for a feature. See
32 // for a given feature name - generally defined as a constant global variable or
34 struct BASE_EXPORT Feature {
35 constexpr Feature(const char* name, FeatureState default_state)
37 // The name of the feature. This should be unique to each feature and is used
41 // The default state (i.e. enabled or disabled) for this feature.
45 // The FeatureList class is used to determine whether a given feature is on or
49 // The basic use case is for any feature that can be toggled (e.g. through
50 // command-line or an experiment) to have a defined Feature struct, e.g.:
52 // const base::Feature kMyGreatFeature {
56 // Then, client code that wishes to query the state of the feature would check:
59 // // Feature code goes here.
63 // flags to enable or disable the feature, any experiments that may control it
65 // whether the feature is on.
68 // separated feature names via the following command-line flags:
85 // Initializes feature overrides via command-line flags |enable_features| and
87 // enable or disable, respectively. If a feature appears on both lists, then
89 // then this initialization will also associate the feature state override
90 // with the named field trial, if it exists. If a feature name is prefixed
98 // Initializes feature overrides through the field trial allocator, which
99 // we're using to store the feature names, their override state, and the name
103 // Specifies whether a feature override enables or disables the feature.
116 // command-line setting the feature state to |for_overridden_state|. The trial
117 // will be activated when the state of the feature is first queried. This
125 // feature to |override_state|. Command-line overrides still take precedence
126 // over field trials, so this will have no effect if the feature is being
128 // activated when the feature state for this feature is queried. This should
135 // Loops through feature overrides and serializes them all into |allocator|.
138 // Returns comma-separated lists of feature names (in the same format that is
149 // Returns whether the given |feature| is enabled. Must only be called after
151 // a feature with a given name must only have a single corresponding Feature
153 static bool IsEnabled(const Feature& feature);
155 // Returns the field trial associated with the given |feature|. Must only be
157 static FieldTrial* GetFieldTrial(const Feature& feature);
159 // Splits a comma-separated string containing feature names into a vector. The
164 // Initializes and sets an instance of FeatureList with feature overrides via
176 // Registers the given |instance| to be the singleton feature list for this
188 // Sets a given (initialized) |instance| to be the singleton feature list,
201 // The overridden enable (on/off) state of the feature.
205 // state of the feature is queried for the first time. Weak pointer to the
209 // Specifies whether the feature's state is overridden by |field_trial|.
225 // singleton feature list that is being registered.
228 // Returns whether the given |feature| is enabled. This is invoked by the
231 bool IsFeatureEnabled(const Feature& feature);
233 // Returns the field trial associated with the given |feature|. This is
237 base::FieldTrial* GetAssociatedFieldTrial(const Feature& feature);
239 // For each feature name in comma-separated list of strings |feature_list|,
246 // Registers an override for feature |feature_name|. The override specifies
247 // whether the feature should be on or off (via |overridden_state|), which
248 // will take precedence over the feature's default state. If |field_trial| is
250 // the feature, which will activate the field trial when the feature state is
251 // queried. If an override is already registered for the given feature, it
257 // Verifies that there's only a single definition of a Feature struct for a
258 // given feature name. Keeps track of the first seen Feature struct for each
259 // feature. Returns false when called on a Feature struct with a different
260 // address than the first one it saw for that feature name. Used only from
262 bool CheckFeatureIdentity(const Feature& feature);
264 // Map from feature name to an OverrideEntry struct for the feature, if it
268 // Locked map that keeps track of seen features, to ensure a single feature is
272 std::map<std::string, const Feature*> feature_identity_tracker_;