[node, glfw] Remove libuv 0.10 support
This commit is contained in:
@@ -7,12 +7,6 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
|
||||
#define UV_ASYNC_PARAMS(handle) uv_async_t *handle, int
|
||||
#else
|
||||
#define UV_ASYNC_PARAMS(handle) uv_async_t *handle
|
||||
#endif
|
||||
|
||||
namespace mbgl {
|
||||
namespace util {
|
||||
|
||||
@@ -45,7 +39,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static void asyncCallback(UV_ASYNC_PARAMS(handle)) {
|
||||
static void asyncCallback(uv_async_t* handle) {
|
||||
reinterpret_cast<Impl*>(handle->data)->task();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,7 @@ namespace {
|
||||
using namespace mbgl::util;
|
||||
static ThreadLocal<RunLoop>& current = *new ThreadLocal<RunLoop>;
|
||||
|
||||
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
|
||||
void dummyCallback(uv_async_t*, int) {}
|
||||
#else
|
||||
void dummyCallback(uv_async_t*) {}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -84,13 +80,8 @@ public:
|
||||
RunLoop::RunLoop(Type type) : impl(std::make_unique<Impl>()) {
|
||||
switch (type) {
|
||||
case Type::New:
|
||||
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
|
||||
impl->loop = uv_loop_new();
|
||||
if (impl->loop == nullptr) {
|
||||
#else
|
||||
impl->loop = new uv_loop_t;
|
||||
if (uv_loop_init(impl->loop) != 0) {
|
||||
#endif
|
||||
throw std::runtime_error("Failed to initialize loop.");
|
||||
}
|
||||
break;
|
||||
@@ -129,14 +120,10 @@ RunLoop::~RunLoop() {
|
||||
impl->async.reset();
|
||||
runOnce();
|
||||
|
||||
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
|
||||
uv_loop_delete(impl->loop);
|
||||
#else
|
||||
if (uv_loop_close(impl->loop) == UV_EBUSY) {
|
||||
throw std::runtime_error("Failed to close loop.");
|
||||
}
|
||||
delete impl->loop;
|
||||
#endif
|
||||
}
|
||||
|
||||
LOOP_HANDLE RunLoop::getLoopHandle() {
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
|
||||
#define UV_TIMER_PARAMS(timer) uv_timer_t *timer, int
|
||||
#else
|
||||
#define UV_TIMER_PARAMS(timer) uv_timer_t *timer
|
||||
#endif
|
||||
|
||||
namespace mbgl {
|
||||
namespace util {
|
||||
|
||||
@@ -46,7 +40,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static void timerCallback(UV_TIMER_PARAMS(handle)) {
|
||||
static void timerCallback(uv_timer_t* handle) {
|
||||
reinterpret_cast<Impl*>(handle->data)->cb();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,6 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
|
||||
#define UV_ASYNC_PARAMS(handle) uv_async_t *handle, int
|
||||
#else
|
||||
#define UV_ASYNC_PARAMS(handle) uv_async_t *handle
|
||||
#endif
|
||||
|
||||
namespace node_mbgl {
|
||||
|
||||
struct NodeMap::RenderOptions {
|
||||
@@ -975,7 +969,7 @@ NodeMap::NodeMap(v8::Local<v8::Object> options)
|
||||
});
|
||||
|
||||
async->data = this;
|
||||
uv_async_init(uv_default_loop(), async, [](UV_ASYNC_PARAMS(h)) {
|
||||
uv_async_init(uv_default_loop(), async, [](uv_async_t* h) {
|
||||
reinterpret_cast<NodeMap *>(h->data)->renderFinished();
|
||||
});
|
||||
|
||||
|
||||
@@ -8,12 +8,6 @@
|
||||
#include <queue>
|
||||
#include <string>
|
||||
|
||||
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
|
||||
#define UV_ASYNC_PARAMS(handle) uv_async_t *handle, int
|
||||
#else
|
||||
#define UV_ASYNC_PARAMS(handle) uv_async_t *handle
|
||||
#endif
|
||||
|
||||
namespace node_mbgl {
|
||||
namespace util {
|
||||
|
||||
@@ -23,7 +17,7 @@ public:
|
||||
AsyncQueue(uv_loop_t *loop, std::function<void(T &)> fn) :
|
||||
callback(fn) {
|
||||
async.data = this;
|
||||
uv_async_init(loop, &async, [](UV_ASYNC_PARAMS(handle)) {
|
||||
uv_async_init(loop, &async, [](uv_async_t* handle) {
|
||||
auto q = reinterpret_cast<AsyncQueue *>(handle->data);
|
||||
q->process();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user