Index: components/metrics/metrics_service.h |
diff --git a/components/metrics/metrics_service.h b/components/metrics/metrics_service.h |
index 234508327238273a11989328dd18d1ef99b617f3..0939c139bd2a17e6dcb7781ab9359d8af6a130b8 100644 |
--- a/components/metrics/metrics_service.h |
+++ b/components/metrics/metrics_service.h |
@@ -28,7 +28,7 @@ |
#include "components/metrics/metrics_log_manager.h" |
#include "components/metrics/metrics_provider.h" |
#include "components/metrics/net/network_metrics_provider.h" |
-#include "components/variations/active_field_trials.h" |
+#include "components/variations/synthetic_trials.h" |
class PrefService; |
class PrefRegistrySimple; |
@@ -55,39 +55,6 @@ class MetricsServiceAccessor; |
class MetricsServiceClient; |
class MetricsStateManager; |
-// A Field Trial and its selected group, which represent a particular |
-// Chrome configuration state. For example, the trial name could map to |
-// a preference name, and the group name could map to a preference value. |
-struct SyntheticTrialGroup { |
- public: |
- ~SyntheticTrialGroup(); |
- |
- variations::ActiveGroupId id; |
- base::TimeTicks start_time; |
- |
- private: |
- // Synthetic field trial users: |
- friend class MetricsServiceAccessor; |
- friend class MetricsService; |
- FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); |
- |
- // This constructor is private specifically so as to control which code is |
- // able to access it. New code that wishes to use it should be added as a |
- // friend class. |
- SyntheticTrialGroup(uint32 trial, uint32 group); |
-}; |
- |
-// Interface class to observe changes to synthetic trials in MetricsService. |
-class SyntheticTrialObserver { |
- public: |
- // Called when the list of synthetic field trial groups has changed. |
- virtual void OnSyntheticTrialsChanged( |
- const std::vector<SyntheticTrialGroup>& groups) = 0; |
- |
- protected: |
- virtual ~SyntheticTrialObserver() {} |
-}; |
- |
// See metrics_service.cc for a detailed description. |
class MetricsService : public base::HistogramFlattener { |
public: |
@@ -216,26 +183,17 @@ class MetricsService : public base::HistogramFlattener { |
// This value should be true when process has completed shutdown. |
static bool UmaMetricsProperlyShutdown(); |
- // Registers a field trial name and group to be used to annotate a UMA report |
- // with a particular Chrome configuration state. A UMA report will be |
- // annotated with this trial group if and only if all events in the report |
- // were created after the trial is registered. Only one group name may be |
- // registered at a time for a given trial_name. Only the last group name that |
- // is registered for a given trial name will be recorded. The values passed |
- // in must not correspond to any real field trial in the code. |
- // To use this method, SyntheticTrialGroup should friend your class. |
- void RegisterSyntheticFieldTrial(const SyntheticTrialGroup& trial_group); |
- |
// Public accessor that returns the list of synthetic field trials. It must |
// only be used for testing. |
void GetCurrentSyntheticFieldTrialsForTesting( |
std::vector<variations::ActiveGroupId>* synthetic_trials); |
// Adds an observer to be notified when the synthetic trials list changes. |
- void AddSyntheticTrialObserver(SyntheticTrialObserver* observer); |
+ void AddSyntheticTrialObserver(variations::SyntheticTrialObserver* observer); |
// Removes an existing observer of synthetic trials list changes. |
- void RemoveSyntheticTrialObserver(SyntheticTrialObserver* observer); |
+ void RemoveSyntheticTrialObserver( |
+ variations::SyntheticTrialObserver* observer); |
// Register the specified |provider| to provide additional metrics into the |
// UMA log. Should be called during MetricsService initialization only. |
@@ -258,6 +216,8 @@ class MetricsService : public base::HistogramFlattener { |
MetricsLogManager* log_manager() { return &log_manager_; } |
private: |
+ friend class MetricsServiceAccessor; |
+ |
// The MetricsService has a lifecycle that is stored as a state. |
// See metrics_service.cc for description of this lifecycle. |
enum State { |
@@ -281,7 +241,17 @@ class MetricsService : public base::HistogramFlattener { |
UNSET |
}; |
- typedef std::vector<SyntheticTrialGroup> SyntheticTrialGroups; |
+ typedef std::vector<variations::SyntheticTrialGroup> SyntheticTrialGroups; |
+ |
+ // Registers a field trial name and group to be used to annotate a UMA report |
+ // with a particular Chrome configuration state. A UMA report will be |
+ // annotated with this trial group if and only if all events in the report |
+ // were created after the trial is registered. Only one group name may be |
+ // registered at a time for a given trial_name. Only the last group name that |
+ // is registered for a given trial name will be recorded. The values passed |
+ // in must not correspond to any real field trial in the code. |
+ void RegisterSyntheticFieldTrial( |
+ const variations::SyntheticTrialGroup& trial_group); |
// Calls into the client to initialize some system profile metrics. |
void StartInitTask(); |
@@ -489,7 +459,8 @@ class MetricsService : public base::HistogramFlattener { |
SyntheticTrialGroups synthetic_trial_groups_; |
// List of observers of |synthetic_trial_groups_| changes. |
- base::ObserverList<SyntheticTrialObserver> synthetic_trial_observer_list_; |
+ base::ObserverList<variations::SyntheticTrialObserver> |
+ synthetic_trial_observer_list_; |
// Execution phase the browser is in. |
static ExecutionPhase execution_phase_; |