Add ability to use movable only functors in rtc::Thread::Invoke(...)
Add support for movable only functors with void return type. Non void
return type is already supported.
Bug: webrtc:10138
Change-Id: If2ae2b5ab7244a0e932bceff7d9853c030805688
Reviewed-on: https://webrtc-review.googlesource.com/c/116740
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26186}
diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc
index 07e9e18..e675375 100644
--- a/pc/channel_unittest.cc
+++ b/pc/channel_unittest.cc
@@ -520,9 +520,10 @@
class ScopedCallThread {
public:
template <class FunctorT>
- explicit ScopedCallThread(const FunctorT& functor)
+ explicit ScopedCallThread(FunctorT&& functor)
: thread_(rtc::Thread::Create()),
- task_(new rtc::FunctorMessageHandler<void, FunctorT>(functor)) {
+ task_(new rtc::FunctorMessageHandler<void, FunctorT>(
+ std::forward<FunctorT>(functor))) {
thread_->Start();
thread_->Post(RTC_FROM_HERE, task_.get());
}