Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Unified Diff: components/ukm/metrics_reporting_scheduler.h

Issue 2567263003: Basic UkmService implementation (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/ukm/metrics_reporting_scheduler.h
diff --git a/components/ukm/metrics_reporting_scheduler.h b/components/ukm/metrics_reporting_scheduler.h
new file mode 100644
index 0000000000000000000000000000000000000000..2641330e5b189149d29fe514a1766a2383d6be0c
--- /dev/null
+++ b/components/ukm/metrics_reporting_scheduler.h
@@ -0,0 +1,37 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_UKM_METRICS_REPORTING_SCHEDULER_H_
+#define COMPONENTS_UKM_METRICS_REPORTING_SCHEDULER_H_
+
+#include "base/time/time.h"
+#include "components/metrics/metrics_reporting_scheduler.h"
+
+namespace ukm {
+
+// Scheduler task to drive a MetricsService object's uploading.
+class MetricsReportingScheduler : public metrics::MetricsReportingScheduler {
+ public:
+ // Creates MetricsServiceScheduler object with the given |upload_callback|
+ // callback to call when uploading should happen and
+ // |upload_interval_callback| to determine the interval between uploads
+ // in steady state.
+ MetricsReportingScheduler(
+ const base::Closure& upload_callback,
+ const base::Callback<base::TimeDelta(void)>& upload_interval_callback);
+ ~MetricsReportingScheduler() override;
+
+ private:
+ // Record the init sequence order histogram.
+ void LogMetricsInitSequence(InitSequence sequence) override;
+
+ // Record the upload interval time.
+ void LogActualUploadInterval(base::TimeDelta interval) override;
+
+ DISALLOW_COPY_AND_ASSIGN(MetricsReportingScheduler);
+};
+
+} // namespace ukm
+
+#endif // COMPONENTS_UKM_METRICS_REPORTING_SCHEDULER_H_

Powered by Google App Engine
This is Rietveld 408576698