123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #ifndef RTC_BASE_ASYNC_INVOKER_INL_H_
- #define RTC_BASE_ASYNC_INVOKER_INL_H_
- #include "api/scoped_refptr.h"
- #include "rtc_base/bind.h"
- #include "rtc_base/event.h"
- #include "rtc_base/message_handler.h"
- #include "rtc_base/ref_counted_object.h"
- #include "rtc_base/third_party/sigslot/sigslot.h"
- #include "rtc_base/thread.h"
- #include "rtc_base/thread_annotations.h"
- namespace rtc {
- class AsyncInvoker;
- class AsyncClosure {
- public:
- explicit AsyncClosure(AsyncInvoker* invoker);
- virtual ~AsyncClosure();
-
-
- virtual void Execute() = 0;
- protected:
- AsyncInvoker* invoker_;
-
-
-
-
- scoped_refptr<RefCountedObject<Event>> invocation_complete_;
- };
- template <class FunctorT>
- class FireAndForgetAsyncClosure : public AsyncClosure {
- public:
- explicit FireAndForgetAsyncClosure(AsyncInvoker* invoker, FunctorT&& functor)
- : AsyncClosure(invoker), functor_(std::forward<FunctorT>(functor)) {}
- virtual void Execute() { functor_(); }
- private:
- typename std::decay<FunctorT>::type functor_;
- };
- }
- #endif
|