0
Files
src/components/power_metrics/sampling_event_source.h
Patrick Monette 4f7bf4eaac Move SamplingEventSource and co to components/power_metrics/
This class and its subclasses will be used in the future to drive
the collection of power metrics in Chrome.

Bug: 1248057
Change-Id: Ie0b0c7ef9d29ebb56a6962847f4e321559d773b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3319536
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/main@{#950286}
2021-12-09 21:49:47 +00:00

27 lines
842 B
C++

// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_POWER_METRICS_SAMPLING_EVENT_SOURCE_H_
#define COMPONENTS_POWER_METRICS_SAMPLING_EVENT_SOURCE_H_
#include "base/callback_forward.h"
namespace power_sampler {
// Invokes a callback when a Sample should be requested from all Samplers.
class SamplingEventSource {
public:
using SamplingEventCallback = base::RepeatingClosure;
virtual ~SamplingEventSource() = 0;
// Starts generating sampling events. Returns whether the operation succeeded.
// |callback| is invoked for every sampling event.
virtual bool Start(SamplingEventCallback callback) = 0;
};
} // namespace power_sampler
#endif // COMPONENTS_POWER_METRICS_SAMPLING_EVENT_SOURCE_H_