ukm_rotation_scheduler.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_UKM_UKM_ROTATION_SCHEDULER_H_
  5. #define COMPONENTS_UKM_UKM_ROTATION_SCHEDULER_H_
  6. #include "base/time/time.h"
  7. #include "components/metrics/metrics_rotation_scheduler.h"
  8. namespace ukm {
  9. // Scheduler to drive a UkmService object's log rotations.
  10. class UkmRotationScheduler : public metrics::MetricsRotationScheduler {
  11. public:
  12. // Creates UkmRotationScheduler object with the given |rotation_callback|
  13. // callback to call when log rotation should happen and |interval_callback|
  14. // to determine the interval between rotations in steady state.
  15. UkmRotationScheduler(
  16. const base::RepeatingClosure& rotation_callback,
  17. bool fast_startup_for_testing,
  18. const base::RepeatingCallback<base::TimeDelta(void)>& interval_callback);
  19. UkmRotationScheduler(const UkmRotationScheduler&) = delete;
  20. UkmRotationScheduler& operator=(const UkmRotationScheduler&) = delete;
  21. ~UkmRotationScheduler() override;
  22. private:
  23. // Record the init sequence order histogram.
  24. void LogMetricsInitSequence(InitSequence sequence) override;
  25. };
  26. } // namespace ukm
  27. #endif // COMPONENTS_UKM_UKM_ROTATION_SCHEDULER_H_