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

Unified Diff: components/metrics/single_sample_metrics_provider.h

Issue 2687583002: Add support for single sample metrics. (Closed)
Patch Set: Add tests. Created 3 years, 8 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/metrics/single_sample_metrics_provider.h
diff --git a/components/metrics/single_sample_metrics_provider.h b/components/metrics/single_sample_metrics_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..f97efd0ec59d4774d32508668680d583c08db831
--- /dev/null
+++ b/components/metrics/single_sample_metrics_provider.h
@@ -0,0 +1,39 @@
+// 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_METRICS_SINGLE_SAMPLE_METRICS_PROVIDER_H_
+#define COMPONENTS_METRICS_SINGLE_SAMPLE_METRICS_PROVIDER_H_
+
+#include "base/macros.h"
+#include "base/metrics/histogram_base.h"
+#include "base/threading/thread_checker.h"
+#include "components/metrics/public/interfaces/single_sample_metrics.mojom.h"
+
+namespace metrics {
+
+class SingleSampleMetricsProvider : public mojom::SingleSampleMetricsProvider {
+ public:
+ static void Create(mojom::SingleSampleMetricsProviderRequest request);
+
+ SingleSampleMetricsProvider();
+ ~SingleSampleMetricsProvider() override;
+
+ private:
+ void AcquireSingleSampleMetric(
+ const std::string& name,
+ base::HistogramBase::Sample min,
+ base::HistogramBase::Sample max,
+ uint32_t bucket_count,
+ int32_t flags,
+ mojom::SingleSampleMetricRequest request) override;
+
+ // Providers must be created, used on, and destroyed on the same thread.
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(SingleSampleMetricsProvider);
+};
+
+} // namespace metrics
+
+#endif // COMPONENTS_METRICS_SINGLE_SAMPLE_METRICS_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698