timer_sampling_event_source.cc 626 B

12345678910111213141516171819202122
  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. #include "base/power_monitor/timer_sampling_event_source.h"
  5. #include "base/check.h"
  6. namespace base {
  7. TimerSamplingEventSource::TimerSamplingEventSource(TimeDelta interval)
  8. : interval_(interval) {}
  9. TimerSamplingEventSource::~TimerSamplingEventSource() = default;
  10. bool TimerSamplingEventSource::Start(SamplingEventCallback callback) {
  11. DCHECK(callback);
  12. timer_.Start(FROM_HERE, interval_, std::move(callback));
  13. return true;
  14. }
  15. } // namespace base