Index: base/metrics/field_trial.h |
diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h |
index e975150cba38378a14c9224636d020cb5ea7a767..a52132bb33576c55e7153610fb54b8a5c272354c 100644 |
--- a/base/metrics/field_trial.h |
+++ b/base/metrics/field_trial.h |
@@ -266,12 +266,6 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { |
// untouched. |
bool GetState(State* field_trial_state); |
- // Adds the field trial to the allocator whose memory is to be shared with |
- // child processes. Assumes the calling code has a lock around the call to |
- // this function, since the check for the allocator is not thread-safe. |
- void AddToAllocatorWhileLocked( |
- base::SharedPersistentMemoryAllocator* allocator); |
- |
// Returns the group_name. A winner need not have been chosen. |
std::string group_name_internal() const { return group_name_; } |
@@ -319,6 +313,9 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { |
// should notify it when its group is queried. |
bool trial_registered_; |
+ // Reference to related field trial struct and data in shared memory. |
+ SharedPersistentMemoryAllocator::Reference ref_; |
+ |
// When benchmarking is enabled, field trials all revert to the 'default' |
// group. |
static bool enable_benchmarking_; |
@@ -523,9 +520,15 @@ class BASE_EXPORT FieldTrialList { |
// Notify all observers that a group has been finalized for |field_trial|. |
static void NotifyFieldTrialGroupSelection(FieldTrial* field_trial); |
+ // Activate the corresponding field trial entry struct in shared memory. |
+ static void ActivateFieldTrialEntry(FieldTrial* field_trial); |
+ |
// Return the number of active field trials. |
static size_t GetFieldTrialCount(); |
+ // Adds the field trial to the allocator. |
+ static void AddToAllocator(FieldTrial* field_trial); |
Alexei Svitkine (slow)
2016/10/25 21:12:29
I don't think these should be in the public API, s
lawrencewu
2016/10/26 13:43:15
Hmm, I'm not sure that solves the problem of addin
Alexei Svitkine (slow)
2016/10/26 14:49:02
Ah right. Well, ok how about just having:
OnGrou
lawrencewu
2016/10/26 15:41:38
Sounds good, done.
|
+ |
private: |
// Allow tests to access our innards for testing purposes. |
FRIEND_TEST_ALL_PREFIXES(FieldTrialListTest, InstantiateAllocator); |
@@ -583,8 +586,8 @@ class BASE_EXPORT FieldTrialList { |
// Allocator used to instantiate field trial in child processes. In the |
// future, we may want to move this to a more generic place if we want to |
// start passing more data other than field trials. |
- std::unique_ptr<base::SharedPersistentMemoryAllocator> |
- field_trial_allocator_ = nullptr; |
+ std::unique_ptr<SharedPersistentMemoryAllocator> field_trial_allocator_ = |
+ nullptr; |
#if defined(OS_WIN) |
// Readonly copy of the handle to the allocator. Needs to be a member variable |