Chromium Code Reviews| Index: base/feature_list.h |
| diff --git a/base/feature_list.h b/base/feature_list.h |
| index 80209ba6588464d769d48215d4ffc54f23d6ac3b..63cf4a7698ce88b6ed927a10257f8ae7bb952bad 100644 |
| --- a/base/feature_list.h |
| +++ b/base/feature_list.h |
| @@ -13,6 +13,7 @@ |
| #include "base/base_export.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| +#include "base/metrics/persistent_memory_allocator.h" |
| #include "base/strings/string_piece.h" |
| #include "base/synchronization/lock.h" |
| @@ -92,6 +93,11 @@ class BASE_EXPORT FeatureList { |
| void InitializeFromCommandLine(const std::string& enable_features, |
| const std::string& disable_features); |
| + // Initializes feature overrides through the field trial allocator, which |
| + // we're using to store the feature names, their override state, and the name |
| + // of the associated field trial. |
| + void InitializeFromSharedMemory(SharedPersistentMemoryAllocator* allocator); |
|
bcwhite
2016/12/01 20:15:15
Better to accept the base PersistentMemoryAllocato
lawrencewu
2016/12/02 19:24:46
Done.
|
| + |
| // Specifies whether a feature override enables or disables the feature. |
| enum OverrideState { |
| OVERRIDE_USE_DEFAULT, |
| @@ -124,6 +130,9 @@ class BASE_EXPORT FeatureList { |
| OverrideState override_state, |
| FieldTrial* field_trial); |
| + // Loops through feature overrides and serializes them all into |allocator|. |
| + void AddFeaturesToAllocator(SharedPersistentMemoryAllocator* allocator); |
| + |
| // 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. For |
| @@ -180,6 +189,8 @@ class BASE_EXPORT FeatureList { |
| private: |
| FRIEND_TEST_ALL_PREFIXES(FeatureListTest, CheckFeatureIdentity); |
| + FRIEND_TEST_ALL_PREFIXES(FeatureListTest, |
| + StoreAndRetrieveFeaturesFromSharedMemory); |
| struct OverrideEntry { |
| // The overridden enable (on/off) state of the feature. |