| Index: base/metrics/field_trial.cc
|
| diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc
|
| index f718ab0371fa3b05cc6be4e0a0ab254e820c1e71..4aa1c151e8e5166439254513e21991c76c8d51c4 100644
|
| --- a/base/metrics/field_trial.cc
|
| +++ b/base/metrics/field_trial.cc
|
| @@ -7,6 +7,7 @@
|
| #include <algorithm>
|
|
|
| #include "base/build_time.h"
|
| +#include "base/callback.h"
|
| #include "base/logging.h"
|
| #include "base/rand_util.h"
|
| #include "base/sha1.h"
|
| @@ -399,8 +400,10 @@ void FieldTrialList::GetActiveFieldTrialGroups(
|
| }
|
|
|
| // static
|
| -bool FieldTrialList::CreateTrialsFromString(const std::string& trials_string,
|
| - FieldTrialActivationMode mode) {
|
| +bool FieldTrialList::CreateTrialsFromString(
|
| + const std::string& trials_string,
|
| + FieldTrialActivationMode mode,
|
| + const IsAcceptedFieldTrialCallback& is_accepted_callback) {
|
| DCHECK(global_);
|
| if (trials_string.empty() || !global_)
|
| return true;
|
| @@ -419,14 +422,16 @@ bool FieldTrialList::CreateTrialsFromString(const std::string& trials_string,
|
| group_name_end - name_end - 1);
|
| next_item = group_name_end + 1;
|
|
|
| - FieldTrial* trial = CreateFieldTrial(name, group_name);
|
| - if (!trial)
|
| - return false;
|
| - if (mode == ACTIVATE_TRIALS) {
|
| - // Call |group()| to mark the trial as "used" and notify observers, if
|
| - // any. This is useful to ensure that field trials created in child
|
| - // processes are properly reported in crash reports.
|
| - trial->group();
|
| + if (is_accepted_callback.is_null() || is_accepted_callback.Run(name)) {
|
| + FieldTrial* trial = CreateFieldTrial(name, group_name);
|
| + if (!trial)
|
| + return false;
|
| + if (mode == ACTIVATE_TRIALS) {
|
| + // Call |group()| to mark the trial as "used" and notify observers, if
|
| + // any. This is useful to ensure that field trials created in child
|
| + // processes are properly reported in crash reports.
|
| + trial->group();
|
| + }
|
| }
|
| }
|
| return true;
|
|
|