| Index: components/metrics/metrics_service.h
|
| diff --git a/components/metrics/metrics_service.h b/components/metrics/metrics_service.h
|
| index eae44f3cf4dc36a02c66fd1dbf90d0421f4853ec..19794ea47a1d455ba858080a2d7d7117b854d5d4 100644
|
| --- a/components/metrics/metrics_service.h
|
| +++ b/components/metrics/metrics_service.h
|
| @@ -21,6 +21,7 @@
|
| #include "base/metrics/histogram_flattener.h"
|
| #include "base/metrics/histogram_snapshot_manager.h"
|
| #include "base/metrics/user_metrics.h"
|
| +#include "base/observer_list.h"
|
| #include "base/time/time.h"
|
| #include "components/metrics/clean_exit_beacon.h"
|
| #include "components/metrics/metrics_log.h"
|
| @@ -76,6 +77,17 @@ struct SyntheticTrialGroup {
|
| 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:
|
| @@ -211,6 +223,12 @@ class MetricsService : public base::HistogramFlattener {
|
| // To use this method, SyntheticTrialGroup should friend your class.
|
| void RegisterSyntheticFieldTrial(const SyntheticTrialGroup& trial_group);
|
|
|
| + // Adds an observer to be notified when the synthetic trials list changes.
|
| + void AddSyntheticTrialObserver(SyntheticTrialObserver* observer);
|
| +
|
| + // Removes an existing observer of synthetic trials list changes.
|
| + void RemoveSyntheticTrialObserver(SyntheticTrialObserver* observer);
|
| +
|
| // Register the specified |provider| to provide additional metrics into the
|
| // UMA log. Should be called during MetricsService initialization only.
|
| void RegisterMetricsProvider(scoped_ptr<MetricsProvider> provider);
|
| @@ -358,6 +376,9 @@ class MetricsService : public base::HistogramFlattener {
|
| // Sets the value of the specified path in prefs and schedules a save.
|
| void RecordBooleanPrefValue(const char* path, bool value);
|
|
|
| + // Notifies observers on a synthetic trial list change.
|
| + void NotifySyntheticTrialObservers();
|
| +
|
| // Returns a list of synthetic field trials that were active for the entire
|
| // duration of the current log.
|
| void GetCurrentSyntheticFieldTrials(
|
| @@ -447,6 +468,9 @@ class MetricsService : public base::HistogramFlattener {
|
| // Field trial groups that map to Chrome configuration states.
|
| SyntheticTrialGroups synthetic_trial_groups_;
|
|
|
| + // List of observers of |synthetic_trial_groups_| changes.
|
| + ObserverList<SyntheticTrialObserver> synthetic_trial_observer_list_;
|
| +
|
| // Execution phase the browser is in.
|
| static ExecutionPhase execution_phase_;
|
|
|
|
|