Add TaskQueue::PostDelayedTaskWithPrecision helper method.
Just like the other PostTask methods, this is just short-hand for invoking the TaskQueueBase's version of the method. Drive-by fix: remove unnecessary return statement of void methods. Bug: webrtc:13604 Change-Id: I3d5cae66bfa06334058386909f041916dbfa5ab8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/255342 Reviewed-by: Mirko Bonadei <mbonadei@google.com> Commit-Queue: Henrik Boström <hbos@webrtc.org> Auto-Submit: Henrik Boström <hbos@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36194}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
2c4a4472a5
commit
19ba552e88
@ -30,18 +30,25 @@ bool TaskQueue::IsCurrent() const {
|
||||
}
|
||||
|
||||
void TaskQueue::PostTask(std::unique_ptr<webrtc::QueuedTask> task) {
|
||||
return impl_->PostTask(std::move(task));
|
||||
impl_->PostTask(std::move(task));
|
||||
}
|
||||
|
||||
void TaskQueue::PostDelayedTask(std::unique_ptr<webrtc::QueuedTask> task,
|
||||
uint32_t milliseconds) {
|
||||
return impl_->PostDelayedTask(std::move(task), milliseconds);
|
||||
impl_->PostDelayedTask(std::move(task), milliseconds);
|
||||
}
|
||||
|
||||
void TaskQueue::PostDelayedHighPrecisionTask(
|
||||
std::unique_ptr<webrtc::QueuedTask> task,
|
||||
uint32_t milliseconds) {
|
||||
return impl_->PostDelayedHighPrecisionTask(std::move(task), milliseconds);
|
||||
impl_->PostDelayedHighPrecisionTask(std::move(task), milliseconds);
|
||||
}
|
||||
|
||||
void TaskQueue::PostDelayedTaskWithPrecision(
|
||||
webrtc::TaskQueueBase::DelayPrecision precision,
|
||||
std::unique_ptr<webrtc::QueuedTask> task,
|
||||
uint32_t milliseconds) {
|
||||
impl_->PostDelayedTaskWithPrecision(precision, std::move(task), milliseconds);
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
@ -100,6 +100,10 @@ class RTC_LOCKABLE RTC_EXPORT TaskQueue {
|
||||
uint32_t milliseconds);
|
||||
void PostDelayedHighPrecisionTask(std::unique_ptr<webrtc::QueuedTask> task,
|
||||
uint32_t milliseconds);
|
||||
void PostDelayedTaskWithPrecision(
|
||||
webrtc::TaskQueueBase::DelayPrecision precision,
|
||||
std::unique_ptr<webrtc::QueuedTask> task,
|
||||
uint32_t milliseconds);
|
||||
|
||||
// std::enable_if is used here to make sure that calls to PostTask() with
|
||||
// std::unique_ptr<SomeClassDerivedFromQueuedTask> would not end up being
|
||||
@ -127,6 +131,18 @@ class RTC_LOCKABLE RTC_EXPORT TaskQueue {
|
||||
PostDelayedHighPrecisionTask(
|
||||
webrtc::ToQueuedTask(std::forward<Closure>(closure)), milliseconds);
|
||||
}
|
||||
template <class Closure,
|
||||
typename std::enable_if<!std::is_convertible<
|
||||
Closure,
|
||||
std::unique_ptr<webrtc::QueuedTask>>::value>::type* = nullptr>
|
||||
void PostDelayedTaskWithPrecision(
|
||||
webrtc::TaskQueueBase::DelayPrecision precision,
|
||||
Closure&& closure,
|
||||
uint32_t milliseconds) {
|
||||
PostDelayedTaskWithPrecision(
|
||||
precision, webrtc::ToQueuedTask(std::forward<Closure>(closure)),
|
||||
milliseconds);
|
||||
}
|
||||
|
||||
private:
|
||||
webrtc::TaskQueueBase* const impl_;
|
||||
|
Reference in New Issue
Block a user