Removes PostStop from RepeatingTaskHandle.
It isn't used and can easily be replaced with posting a task, as shown
in the changes to the unit test.
Also removing the sequenced task checker that no longer adds any value.
We now ensure that the task can only be stopped with a reference to the
task queue it runs on.
Bug: webrtc:10365
Change-Id: Ie8aef6f742c55db1fb686f20c2a28c606c721fa0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/129725
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27292}
diff --git a/rtc_base/task_utils/repeating_task.h b/rtc_base/task_utils/repeating_task.h
index eaf2a4b..21ec130 100644
--- a/rtc_base/task_utils/repeating_task.h
+++ b/rtc_base/task_utils/repeating_task.h
@@ -38,7 +38,6 @@
bool Run() final;
void Stop() RTC_RUN_ON(task_queue_);
- void PostStop();
TaskQueueBase* const task_queue_;
// This is always finite, except for the special case where it's PlusInfinity
@@ -77,8 +76,8 @@
// not thread safe.
class RepeatingTaskHandle {
public:
- RepeatingTaskHandle();
- ~RepeatingTaskHandle();
+ RepeatingTaskHandle() = default;
+ ~RepeatingTaskHandle() = default;
RepeatingTaskHandle(RepeatingTaskHandle&& other);
RepeatingTaskHandle& operator=(RepeatingTaskHandle&& other);
RepeatingTaskHandle(const RepeatingTaskHandle&) = delete;
@@ -122,11 +121,6 @@
// closure itself.
void Stop();
- // Stops future invocations of the repeating task closure. The closure might
- // still be running when PostStop() returns, but there will be no future
- // invocation.
- void PostStop();
-
// Returns true if Start() or DelayedStart() was called most recently. Returns
// false initially and if Stop() or PostStop() was called most recently.
bool Running() const;
@@ -134,10 +128,8 @@
private:
explicit RepeatingTaskHandle(
webrtc_repeating_task_impl::RepeatingTaskBase* repeating_task);
- rtc::SequencedTaskChecker sequence_checker_;
// Owned by the task queue.
- webrtc_repeating_task_impl::RepeatingTaskBase* repeating_task_
- RTC_GUARDED_BY(sequence_checker_) = nullptr;
+ webrtc_repeating_task_impl::RepeatingTaskBase* repeating_task_ = nullptr;
};
} // namespace webrtc