Chromium Code Reviews| Index: base/metrics/field_trial_param_associator.h |
| diff --git a/base/metrics/field_trial_param_associator.h b/base/metrics/field_trial_param_associator.h |
| index 214e146966eebbdf8fe0888f4c705eea1f251fb0..72bb89743fa0277fb04b0d7e1241294b79192f3c 100644 |
| --- a/base/metrics/field_trial_param_associator.h |
| +++ b/base/metrics/field_trial_param_associator.h |
| @@ -33,10 +33,17 @@ class BASE_EXPORT FieldTrialParamAssociator { |
| const std::string& group_name, |
| const FieldTrialParams& params); |
| - // Gets the parameters for a field trial and its chosen group. |
| + // Gets the parameters for a field trial. If the parameters are not in the |
| + // mapping, then check the field trial entry in shared memory for the |
| + // parameters and cache them here. |
| bool GetFieldTrialParams(const std::string& trial_name, |
| FieldTrialParams* params); |
| + // Same as above. |
| + bool GetFieldTrialParams(const std::string& trial_name, |
|
Alexei Svitkine (slow)
2016/11/01 19:13:27
Overloads are discouraged by the style guide. Chan
lawrencewu
2016/11/01 19:59:58
Expanded the comment and changed the function to G
|
| + const std::string& group_name, |
| + FieldTrialParams* params); |
| + |
| // Clears the internal field_trial_params_ mapping. |
| void ClearAllParamsForTesting(); |
| @@ -46,6 +53,17 @@ class BASE_EXPORT FieldTrialParamAssociator { |
| // (field_trial_name, field_trial_group) |
| typedef std::pair<std::string, std::string> FieldTrialKey; |
| + // Looks up the field trial entry in shared memory and gets the params from |
| + // there. |
| + bool GetParamsFromSharedMemory(const std::string& trial_name, |
| + const std::string& group_name, |
| + FieldTrialParams* params); |
| + |
| + // Sets the parameters for |trial_name| and |group_name|. Caller must lock. |
| + bool AssociateParamsWhileLocked(const std::string& trial_name, |
| + const std::string& group_name, |
| + const FieldTrialParams& params); |
| + |
| Lock lock_; |
| std::map<FieldTrialKey, FieldTrialParams> field_trial_params_; |