diff options
Diffstat (limited to 'platform/darwin/src/run_loop.cpp')
-rw-r--r-- | platform/darwin/src/run_loop.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/platform/darwin/src/run_loop.cpp b/platform/darwin/src/run_loop.cpp index 2ba8f8415b..206fee0531 100644 --- a/platform/darwin/src/run_loop.cpp +++ b/platform/darwin/src/run_loop.cpp @@ -1,6 +1,11 @@ #include <mbgl/util/run_loop.hpp> #include <mbgl/util/async_task.hpp> +#include <mbgl/util/timer.hpp> +#include <mbgl/util/platform.hpp> +#include <mbgl/actor/mailbox.hpp> +#include <mbgl/actor/message.hpp> #include <mbgl/actor/scheduler.hpp> +#include <mbgl/util/scheduled_timer.hpp> #include <CoreFoundation/CoreFoundation.h> @@ -13,7 +18,7 @@ public: }; RunLoop* RunLoop::Get() { - assert(static_cast<RunLoop*>(Scheduler::GetCurrent())); + assert(dynamic_cast<RunLoop*>(Scheduler::GetCurrent())); return static_cast<RunLoop*>(Scheduler::GetCurrent()); } @@ -45,6 +50,10 @@ void RunLoop::runOnce() { void RunLoop::stop() { invoke([&] { CFRunLoopStop(CFRunLoopGetCurrent()); }); } + +std::unique_ptr<Scheduler::Scheduled> RunLoop::schedule(Duration timeout, std::weak_ptr<Mailbox> mailbox, std::unique_ptr<Message> message) { + return std::make_unique<ScheduledTimer>(*this, timeout, std::move(mailbox), std::move(message)); +} } // namespace util } // namespace mbgl |