• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_METRICS_PERSISTENT_SYNTHETIC_TRIAL_OBSERVER_H_
6 #define COMPONENTS_METRICS_PERSISTENT_SYNTHETIC_TRIAL_OBSERVER_H_
7 
8 #include "base/task/sequenced_task_runner.h"
9 #include "components/variations/synthetic_trials.h"
10 
11 namespace metrics {
12 
13 // Stores synthetic field trials to persistent storage when they are updated.
14 class PersistentSyntheticTrialObserver
15     : public variations::SyntheticTrialObserver {
16  public:
17   PersistentSyntheticTrialObserver();
18   ~PersistentSyntheticTrialObserver() override;
19 
20   PersistentSyntheticTrialObserver(const PersistentSyntheticTrialObserver&) =
21       delete;
22   PersistentSyntheticTrialObserver& operator=(
23       const PersistentSyntheticTrialObserver&) = delete;
24 
25   // SyntheticTrialObserver impl:
26   void OnSyntheticTrialsChanged(
27       const std::vector<variations::SyntheticTrialGroup>& trials_updated,
28       const std::vector<variations::SyntheticTrialGroup>& trials_removed,
29       const std::vector<variations::SyntheticTrialGroup>& groups) override;
30 
31  private:
32   scoped_refptr<base::SequencedTaskRunner> task_runner_;
33 };
34 
35 }  // namespace metrics
36 
37 #endif  // COMPONENTS_METRICS_PERSISTENT_SYNTHETIC_TRIAL_OBSERVER_H_
38