xref: /aosp_15_r20/external/cronet/base/power_monitor/sampling_event_source.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_POWER_MONITOR_SAMPLING_EVENT_SOURCE_H_
6 #define BASE_POWER_MONITOR_SAMPLING_EVENT_SOURCE_H_
7 
8 #include "base/base_export.h"
9 #include "base/functional/callback_forward.h"
10 
11 namespace base {
12 
13 // Invokes a callback when a Sample should be requested from all Samplers.
14 class BASE_EXPORT SamplingEventSource {
15  public:
16   using SamplingEventCallback = RepeatingClosure;
17 
18   virtual ~SamplingEventSource() = 0;
19 
20   // Starts generating sampling events. Returns whether the operation succeeded.
21   // |callback| is invoked for every sampling event.
22   virtual bool Start(SamplingEventCallback callback) = 0;
23 };
24 
25 }  // namespace base
26 
27 #endif  // BASE_POWER_MONITOR_SAMPLING_EVENT_SOURCE_H_
28