sampling_event_source.h 842 B

123456789101112131415161718192021222324252627
  1. // Copyright 2021 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_POWER_MONITOR_SAMPLING_EVENT_SOURCE_H_
  5. #define BASE_POWER_MONITOR_SAMPLING_EVENT_SOURCE_H_
  6. #include "base/base_export.h"
  7. #include "base/callback_forward.h"
  8. namespace base {
  9. // Invokes a callback when a Sample should be requested from all Samplers.
  10. class BASE_EXPORT SamplingEventSource {
  11. public:
  12. using SamplingEventCallback = RepeatingClosure;
  13. virtual ~SamplingEventSource() = 0;
  14. // Starts generating sampling events. Returns whether the operation succeeded.
  15. // |callback| is invoked for every sampling event.
  16. virtual bool Start(SamplingEventCallback callback) = 0;
  17. };
  18. } // namespace base
  19. #endif // BASE_POWER_MONITOR_SAMPLING_EVENT_SOURCE_H_