| Index: base/metrics/field_trial.h
|
| ===================================================================
|
| --- base/metrics/field_trial.h (revision 70854)
|
| +++ base/metrics/field_trial.h (working copy)
|
| @@ -67,6 +67,7 @@
|
| #include <string>
|
|
|
| #include "base/lock.h"
|
| +#include "base/logging.h"
|
| #include "base/ref_counted.h"
|
| #include "base/time.h"
|
|
|
| @@ -110,8 +111,18 @@
|
| // If the field trial is not in an experiment, this returns the empty string.
|
| // if the group's name is empty, a name of "_" concatenated with the group
|
| // number is used as the group name.
|
| - std::string group_name() const { return group_name_; }
|
| + std::string group_name() const {
|
| + DCHECK(all_remaining_probability_set_);
|
| + return group_name_;
|
| + }
|
|
|
| + // Set the usage_timeout from build time of the module to disable Field Trial.
|
| + void SetUsageTimeout(const base::TimeDelta& usage_timeout);
|
| +
|
| + base::TimeDelta usageTimeout() const {
|
| + return usage_timeout_;
|
| + }
|
| +
|
| // Helper function for the most common use: as an argument to specifiy the
|
| // name of a HISTOGRAM. Use the original histogram name as the name_prefix.
|
| static std::string MakeName(const std::string& name_prefix,
|
| @@ -125,6 +136,17 @@
|
|
|
| virtual ~FieldTrial();
|
|
|
| + // Determine if the field trial is to be disabled or not based on
|
| + // usage_timeout_, build time of the module and Now(). This method sets
|
| + // disable_field_trial_ to true, if the difference between build time of the
|
| + // module and Now() is greater than usage_timeout_. If disable_field_trial_ is
|
| + // true then the field trial reverts to the 'default' bucket.
|
| + static bool ShouldFieldTrialBeDisabled(
|
| + const base::TimeDelta& usage_timeout);
|
| +
|
| + // Get build time.
|
| + static Time GetBuildTime();
|
| +
|
| // The name of the field trial, as can be found via the FieldTrialList.
|
| // This is empty of the trial is not in the experiment.
|
| const std::string name_;
|
| @@ -151,6 +173,18 @@
|
| // If this Trial is not a member of an group, this string is empty.
|
| std::string group_name_;
|
|
|
| + // Used to assert that kAllRemainingProbability is beig used.
|
| + // bucket.
|
| + bool all_remaining_probability_set_;
|
| +
|
| + // The default value (all remaining probabilities) can be selected after the
|
| + // usage_timeout, which is based on the build time of the module.
|
| + base::TimeDelta usage_timeout_;
|
| +
|
| + // When disable_field_trial_ is true, field trial reverts to the 'default'
|
| + // bucket.
|
| + bool disable_field_trial_;
|
| +
|
| // When benchmarking is enabled, field trials all revert to the 'default'
|
| // bucket.
|
| static bool enable_benchmarking_;
|
|
|