xref: /aosp_15_r20/external/cronet/base/power_monitor/timer_sampling_event_source.cc (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 #include "base/power_monitor/timer_sampling_event_source.h"
6 
7 #include "base/check.h"
8 
9 namespace base {
10 
TimerSamplingEventSource(TimeDelta interval)11 TimerSamplingEventSource::TimerSamplingEventSource(TimeDelta interval)
12     : interval_(interval) {}
13 
14 TimerSamplingEventSource::~TimerSamplingEventSource() = default;
15 
Start(SamplingEventCallback callback)16 bool TimerSamplingEventSource::Start(SamplingEventCallback callback) {
17   DCHECK(callback);
18   timer_.Start(FROM_HERE, interval_, std::move(callback));
19   return true;
20 }
21 
22 }  // namespace base
23