Index: base/metrics/field_trial.h |
=================================================================== |
--- base/metrics/field_trial.h (revision 70854) |
+++ base/metrics/field_trial.h (working copy) |
@@ -112,6 +112,18 @@ |
// number is used as the group name. |
std::string group_name() const { return group_name_; } |
+ // Return true if there is a default group with kAllRemainingProbability. |
+ // all_remaining_probability_set_ is set to true when AppendGroup is called |
+ // with kAllRemainingProbability as group probability. When MakeName is called |
+ // we assert that all_remaining_probability_set_ is set to true. |
+ bool all_remaining_probability_set() const { |
+ return all_remaining_probability_set_; |
+ } |
+ |
+ // Set the usage_timeout from build time of the module to disable Field Trial. |
+ void SetUsageTimeout(const base::TimeDelta& usage_timeout); |
+ base::TimeDelta usage_timeout() 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 +137,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 +174,17 @@ |
// If this Trial is not a member of an group, this string is empty. |
std::string group_name_; |
+ // Set to true if there is a default group with kAllRemainingProbability. |
+ 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_; |