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

Unified Diff: base/feature_list.h

Issue 2546653002: Store and retrieve features from shared memory (Closed)
Patch Set: add comment Created 4 years 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 80209ba6588464d769d48215d4ffc54f23d6ac3b..daedd73874198be91fffdcebe72784813c561c8a 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(PersistentMemoryAllocator* allocator);
+
// 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(PersistentMemoryAllocator* 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,10 @@ class BASE_EXPORT FeatureList {
private:
FRIEND_TEST_ALL_PREFIXES(FeatureListTest, CheckFeatureIdentity);
+ FRIEND_TEST_ALL_PREFIXES(FeatureListTest,
+ StoreAndRetrieveFeaturesFromSharedMemory);
+ FRIEND_TEST_ALL_PREFIXES(FeatureListTest,
+ StoreAndRetrieveAssociatedFeaturesFromSharedMemory);
struct OverrideEntry {
// The overridden enable (on/off) state of the feature.
« 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