record_histogram_checker.h 909 B

12345678910111213141516171819202122232425262728
  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 BASE_METRICS_RECORD_HISTOGRAM_CHECKER_H_
  5. #define BASE_METRICS_RECORD_HISTOGRAM_CHECKER_H_
  6. #include <stdint.h>
  7. #include "base/base_export.h"
  8. namespace base {
  9. // RecordHistogramChecker provides an interface for checking whether
  10. // the given histogram should be recorded.
  11. class BASE_EXPORT RecordHistogramChecker {
  12. public:
  13. virtual ~RecordHistogramChecker() = default;
  14. // Returns true iff the given histogram should be recorded.
  15. // This method may be called on any thread, so it should not mutate any state.
  16. // |histogram_hash| corresponds to the result of HashMetricNameAs32Bits().
  17. virtual bool ShouldRecord(uint32_t histogram_hash) const = 0;
  18. };
  19. } // namespace base
  20. #endif // BASE_METRICS_RECORD_HISTOGRAM_CHECKER_H_