Index: base/metrics/field_trial.h |
=================================================================== |
--- base/metrics/field_trial.h (revision 70854) |
+++ base/metrics/field_trial.h (working copy) |
@@ -94,6 +94,13 @@ |
// to the total_probability. |
FieldTrial(const std::string& name, Probability total_probability); |
+ // Determine if the field trial is to be disabled or not based on |
+ // disable_duration_, build time of the module and Now(). This method sets |
+ // disable_field_trail_ to true, if the difference between build time of the |
+ // module and Now() is greater than disable_duration_. If disable_field_trail_ |
+ // is true then the field trial reverts to the 'default' bucket. |
+ void FieldTrial::DetermineIfFieldTrailIsToBeDisabled(); |
+ |
// Establish the name and probability of the next group in this trial. |
// Sometimes, based on construction randomization, this call may causes the |
// provided group to be *THE* group selected for use in this instance. |
@@ -112,6 +119,13 @@ |
// number is used as the group name. |
std::string group_name() const { return group_name_; } |
+ // Set the duration from build time of the module to disable Field Trial. |
+ void SetDisableDuration(const base::TimeDelta& duration); |
+ |
+ base::TimeDelta disableDuration() const { |
+ return disable_duration_; |
+ } |
+ |
// 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, |
@@ -120,6 +134,9 @@ |
// Enable benchmarking sets field trials to a common setting. |
static void EnableBenchmarking(); |
+ // Get build time. |
+ static Time GetBuildTime(); |
+ |
private: |
friend class RefCounted<FieldTrial>; |
@@ -143,6 +160,14 @@ |
int next_group_number_; |
+ // The default value (all remaining probabilities) can be selected after the |
+ // duration, which is based on the build time of the module. |
+ base::TimeDelta disable_duration_; |
+ |
+ // When disable_field_trail_ is true, field trial reverts to the 'default' |
+ // bucket. |
+ bool disable_field_trail_; |
+ |
// The pseudo-randomly assigned group number. |
// This is kNotParticipating if no group has been assigned. |
int group_; |