Migrate CallStats and RtpStreamsSynchronizer timers over to RepeatingTask
Bug: none
Change-Id: Ib49a3de74c6d3a6d4ea158383a5e4b69a1e58ab9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175000
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31252}
diff --git a/rtc_base/task_utils/repeating_task.cc b/rtc_base/task_utils/repeating_task.cc
index 4e460bb..71911e6 100644
--- a/rtc_base/task_utils/repeating_task.cc
+++ b/rtc_base/task_utils/repeating_task.cc
@@ -20,12 +20,14 @@
RepeatingTaskBase::RepeatingTaskBase(TaskQueueBase* task_queue,
TimeDelta first_delay)
: task_queue_(task_queue),
- next_run_time_(Timestamp::Micros(rtc::TimeMicros()) + first_delay) {}
+ next_run_time_(Timestamp::Micros(rtc::TimeMicros()) + first_delay) {
+ sequence_checker_.Detach();
+}
RepeatingTaskBase::~RepeatingTaskBase() = default;
bool RepeatingTaskBase::Run() {
- RTC_DCHECK_RUN_ON(task_queue_);
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
// Return true to tell the TaskQueue to destruct this object.
if (next_run_time_.IsPlusInfinity())
return true;
@@ -51,6 +53,7 @@
}
void RepeatingTaskBase::Stop() {
+ RTC_DCHECK_RUN_ON(&sequence_checker_);
RTC_DCHECK(next_run_time_.IsFinite());
next_run_time_ = Timestamp::PlusInfinity();
}
@@ -75,7 +78,6 @@
void RepeatingTaskHandle::Stop() {
if (repeating_task_) {
- RTC_DCHECK_RUN_ON(repeating_task_->task_queue_);
repeating_task_->Stop();
repeating_task_ = nullptr;
}