chromium/third_party/webrtc_overrides/low_precision_timer.h

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_WEBRTC_OVERRIDES_LOW_PRECISION_TIMER_H_
#define THIRD_PARTY_BLINK_WEBRTC_OVERRIDES_LOW_PRECISION_TIMER_H_

#include "base/feature_list.h"
#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/synchronization/lock.h"
#include "base/task/sequenced_task_runner.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "third_party/webrtc/rtc_base/system/rtc_export.h"
#include "third_party/webrtc_overrides/metronome_source.h"

namespace blink {

// Implements a low precision timer, expect it to fire up to ~16 ms late (plus
// any OS or workload related delays).
//
// This timer only fires on metronome ticks as specified by
// MetronomeSource::TimeSnappedToNextTick(). This allows running numerous timers
// without increasing the Idle Wake Ups frequency beyond the metronome tick
// frequency, i.e. when each tick is already scheduled adding a
// LowPrecisionTimer should not add any Idle Wake Ups.
//
// TODO(https://crbug.com/1267874): Can this timer be moved to base/ or replaced
// by a low precision base/ timer without causing excessive Idle Wake Up
// frequencies (e.g. WebRTC use case with 50 incoming videos)?
class RTC_EXPORT LowPrecisionTimer final {};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_WEBRTC_OVERRIDES_LOW_PRECISION_TIMER_H_