[general] moving ios and android project under ./platform folder

This commit is contained in:
Petr Pokorny
2020-12-20 12:38:56 +01:00
parent 8e759a51e4
commit 41f0be34e7
9877 changed files with 141 additions and 2889 deletions

View File

@@ -0,0 +1,49 @@
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/async_task.hpp>
#include <mbgl/actor/scheduler.hpp>
#include <CoreFoundation/CoreFoundation.h>
namespace mbgl {
namespace util {
class RunLoop::Impl {
public:
std::unique_ptr<AsyncTask> async;
};
RunLoop* RunLoop::Get() {
assert(static_cast<RunLoop*>(Scheduler::GetCurrent()));
return static_cast<RunLoop*>(Scheduler::GetCurrent());
}
RunLoop::RunLoop(Type)
: impl(std::make_unique<Impl>()) {
assert(!Scheduler::GetCurrent());
Scheduler::SetCurrent(this);
impl->async = std::make_unique<AsyncTask>(std::bind(&RunLoop::process, this));
}
RunLoop::~RunLoop() {
Scheduler::SetCurrent(nullptr);
}
void RunLoop::wake() {
impl->async->send();
}
void RunLoop::run() {
CFRunLoopRun();
}
void RunLoop::runOnce() {
wake();
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false);
}
void RunLoop::stop() {
invoke([&] { CFRunLoopStop(CFRunLoopGetCurrent()); });
}
} // namespace util
} // namespace mbgl