Index: components/metrics/single_value_counts_histogram.h |
diff --git a/components/metrics/single_value_counts_histogram.h b/components/metrics/single_value_counts_histogram.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f67913d61de4fbb802c929a7b2d626706be90fab |
--- /dev/null |
+++ b/components/metrics/single_value_counts_histogram.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_METRICS_SINGLE_VALUE_COUNTS_HISTOGRAM_H_ |
+#define COMPONENTS_METRICS_SINGLE_VALUE_COUNTS_HISTOGRAM_H_ |
+ |
+#include "base/macros.h" |
+#include "base/metrics/histogram_base.h" |
+#include "components/metrics/public/interfaces/single_value_histograms.mojom.h" |
+ |
+namespace metrics { |
+ |
+class SingleValueCountsHistogram : public mojom::SingleValueCountsHistogram { |
+ public: |
+ SingleValueCountsHistogram(const std::string& name, |
+ base::HistogramBase::Sample min, |
+ base::HistogramBase::Sample max, |
+ uint32_t bucket_count); |
+ ~SingleValueCountsHistogram() override; |
+ |
+ private: |
+ // mojom::SingleValueCountsHistogram implementation. |
+ void SetSample(base::HistogramBase::Sample sample) override; |
+ |
+ base::HistogramBase* const histogram_; |
+ |
+ // The last sample provided to SetSample(). We use -1 as a sentinel value to |
+ // indicate no sample has been set. |
+ base::HistogramBase::Sample sample_ = -1; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SingleValueCountsHistogram); |
+}; |
+ |
+} // namespace metrics |
+ |
+#endif // COMPONENTS_METRICS_SINGLE_VALUE_COUNTS_HISTOGRAM_H_ |