Index: base/metrics/field_trial.h |
diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h |
index 9a7e5d26f25cf7bd3069b7fd2fe4dd65bdf65f1c..509ace4f77df5a6ec62a80d13eb18f19813a482b 100644 |
--- a/base/metrics/field_trial.h |
+++ b/base/metrics/field_trial.h |
@@ -251,6 +251,10 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { |
// status. |
void FinalizeGroupChoice(); |
+ // Implements FinalizeGroupChoice() with the added flexibility of being |
+ // deadlock-free if |is_locked| is true and the caller is holding a lock. |
+ void FinalizeGroupChoiceImpl(bool is_locked); |
+ |
// Returns the trial name and selected group name for this field trial via |
// the output parameter |active_group|, but only if the group has already |
// been chosen and has been externally observed via |group()| and the trial |
@@ -266,6 +270,10 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { |
// untouched. |
bool GetState(State* field_trial_state); |
+ // Does the same thing as above, but is deadlock-free if the caller is holding |
+ // a lock. |
+ bool GetStateWhileLocked(State* field_trial_state); |
+ |
// Returns the group_name. A winner need not have been chosen. |
std::string group_name_internal() const { return group_name_; } |
@@ -517,9 +525,9 @@ class BASE_EXPORT FieldTrialList { |
// Remove an observer. |
static void RemoveObserver(Observer* observer); |
- // Grabs the lock and adds the field trial to the allocator. This should only |
- // be called from FinalizeGroupChoice(). |
- static void OnGroupFinalized(FieldTrial* field_trial); |
+ // Grabs the lock if necessary and adds the field trial to the allocator. This |
+ // should only be called from FinalizeGroupChoice(). |
+ static void OnGroupFinalized(bool is_locked, FieldTrial* field_trial); |
// Notify all observers that a group has been finalized for |field_trial|. |
static void NotifyFieldTrialGroupSelection(FieldTrial* field_trial); |