Title: Theory / Important / CS / Programming / Objective-C / Library / Feature
Tags: automatedNewLineAfterCommaSpace

Typ: FeatureState
Meaning: whether a given feature is enabled or disabled by default.
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C

Typ: Feature
Meaning: define the default state for a feature
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Assuming: Each state must be distinct. Use constant to ensure it

Variable: feature.name
Meaning: The name of the feature.
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Variables: Feature feature
Assuming: Must be unique

Variable: feature.default_state
Meaning: The default state (i.e. enabled or disabled) for this feature.
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Typ: FeatureState
Variables: Feature feature

Instruction: kMyGreatFeature {
  name,
  base::FEATURE_(DIS|EN)ABLED_BY_DEFAULT
};
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Returns: A feature called name that is (dis/en)abled by default
Typ: base::Feature

Instruction: base::FeatureList::IsEnabled(feature)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Returns: whether feature is enabled
Variables: base::Feature feature

Question: How does Chrome decide whether a feature is on or off
Answer: Command line flag
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Answer2: Experiment otherwise
Answer3: default value otherwise

Fla: --(en|dis)able-features=Feature_1,...,Feature_n
Effect: Same as
--(en|dis)able-features=foo_1,
...,
and --(en|dis)able-features=foo_n
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Context: chrome

Typ: FeatureList
Meaning: determine whether a given feature is on or off
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Context: chrome

Name: An overriden feature
Definition: A feature set explicitly in command line or in a trial
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Context: chrome
Typ: FeatureList

Fla: --enable-features=feature_name<trial_name
Effect: Enable feature_name and associate it to trial_name
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Context: chrome

Fla: --enable-features=feature_name:k1/v1/.../kn/vn
Effect: Enable feature_name with keys key_i associated to value value_i
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Context: chrome

Instruction: base::FeatureList::IsFeatureOverriden(feature_name)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Context: chrome
Returns: whether feature_name is overriden

Instruction: base::FeatureList::IsFeatureOverridenFromCommandLine(feature_name)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Context: chrome
Returns: whether feature_name is overriden from command line

Instruction: base::FeatureList::IsFeatureOverridenFromCommandLine(
  feature_name,
  state
)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Context: chrome
Returns: whether feature_name is overriden from command line and the state matches state
Variables: OverrideStates state

Instruction: base::FeatureList::GetAssociatedFieldTrialByFeatureName(
  feature_name
)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Context: chrome
Returns: the field trial associated with the given feature |name|

Instruction: base::FeatureList::GetEnabledFieldTrialByFeatureName(feature_name)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Context: chrome
Returns: associated field trial for the given feature |name| only if override enables it.

Instruction: base::FeatureList::GetStateIfOverridden(feature)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Context: chrome
Returns: If the given |feature| is overridden, returns its enabled state; otherwise, returns an empty optional.

Instruction: base::FeatureList::GetFieldTrial(feature)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/feature_list.h
Language: Objective-C
Context: chrome
Returns: The field trial associated with the given |feature|

Typ: ScopedFeatureList
Meaning: resets the global FeatureList instance to a new empty instance and restores the original instance upon destruction
Page: https://chromium.googlesource.com/chromium/src/+/main/base/test/scoped_feature_list.h
Language: Objective-C
Context: chrome

Instruction: scoped_feature_list.Reset()
Page: https://chromium.googlesource.com/chromium/src/+/main/base/test/scoped_feature_list.h
Effect: Resets the instance to a non-initialized state.
Language: Objective-C
Context: chrome
Variables: ScopedFeatureList scoped_feature_list

Instruction: scoped_feature_list.Init()
Page: https://chromium.googlesource.com/chromium/src/+/main/base/test/scoped_feature_list.h
Effect: Initializes and registers a FeatureList instance without any additional enabled or disabled features. Existing state, if any, will be kept.
Language: Objective-C
Context: chrome
Variables: ScopedFeatureList scoped_feature_list

Instruction: scoped_feature_list.InitWithFeatures(
  enable_features,
  disabled_fetaures
)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/test/scoped_feature_list.h
Effect: Initializes and registers a FeatureList instance based on present
FeatureList and overridden with the given enabled and disabled features.
Language: Objective-C
Context: chrome
Variables: ScopedFeatureList scoped_feature_list

Instruction: scoped_feature_list.InitAndenableFeature(
  enable_features,
  disabled_fetaures
)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/test/scoped_feature_list.h
Effect: Initializes and registers a FeatureList instance based on present  FeatureList and overridden with single enabled feature.
Language: Objective-C
Context: chrome
Variables: ScopedFeatureList scoped_feature_list

Instruction: scoped_feature_list.InitAndenableFeatureWithParameters(
  feature,
  feature_parameters
)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/test/scoped_feature_list.h
Effect: Initializes and registers a FeatureList instance based on present FeatureList and overridden with single enabled feature and associated field trial parameters.
Language: Objective-C
Context: chrome
Variables: ScopedFeatureList scoped_feature_list
Extra: this creates a scoped global field trial list if there is not currently one.

Instruction: scoped_feature_list.InitWithFeaturesAndParameters(
  enabled_features_and_parameters,
  disabled_features
)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/test/scoped_feature_list.h
Effect: Initializes and registers a FeatureList instance based on present FeatureList and overridden with the given enabled features and the  specified field trial parameters, and the given disabled features.
Language: Objective-C
Context: chrome
Variables: ScopedFeatureList scoped_feature_list
Extra: this creates a scoped global field trial list if there is not currently one.

Instruction: scoped_feature_list.InitAndDisableFeature(feature)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/test/scoped_feature_list.h
Effect: Initializes and registers a FeatureList instance based on present FeatureList and overridden with single disabled feature.
Language: Objective-C
Context: chrome
Variables: ScopedFeatureList scoped_feature_list

Instruction: scoped_feature_list.InitWithFeatureState(
  feature,
  boolean
)
Page: https://chromium.googlesource.com/chromium/src/+/main/base/test/scoped_feature_list.h
Effect: Initializes and registers a FeatureList instance based on present FeatureList and overriden with a single feature either enabled or disabled depending on |enabled|.
Language: Objective-C
Context: chrome
Variables: ScopedFeatureList scoped_feature_list