diff --git a/Makefile b/Makefile index a763090583..47ed6cfd62 100644 --- a/Makefile +++ b/Makefile @@ -277,7 +277,7 @@ test/addons-napi/.buildstamp: config.gypi \ $(ADDONS_NAPI_BINDING_GYPS) $(ADDONS_NAPI_BINDING_SOURCES) \ deps/uv/include/*.h deps/v8/include/*.h \ src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h \ - src/node_api.h src/node_api_async.h + src/node_api.h src/node_api_types.h # Cannot use $(wildcard test/addons/*/) here, it's evaluated before # embedded addons have been generated from the documentation. @for dirname in test/addons-napi/*/; do \ diff --git a/node.gyp b/node.gyp index 453acd5e96..3251244ff6 100644 --- a/node.gyp +++ b/node.gyp @@ -166,9 +166,6 @@ 'src/node_api.cc', 'src/node_api.h', 'src/node_api_types.h', - 'src/node_api_async.cc', - 'src/node_api_async.h', - 'src/node_api_async_types.h', 'src/node_buffer.cc', 'src/node_config.cc', 'src/node_constants.cc', diff --git a/src/node_api_async.cc b/src/node_api_async.cc deleted file mode 100644 index 4eda6c43b3..0000000000 --- a/src/node_api_async.cc +++ /dev/null @@ -1,69 +0,0 @@ -#include "node_api_async.h" -#include "uv.h" - -typedef struct napi_work_impl__ { - uv_work_t* work; - void* data; - void (*execute)(void* data); - void (*complete)(void* data); - void (*destroy)(void* data); -} napi_work_impl; - -napi_work napi_create_async_work() { - napi_work_impl* worker = - reinterpret_cast(malloc(sizeof(napi_work_impl))); - uv_work_t* req = reinterpret_cast(malloc(sizeof(uv_work_t))); - req->data = worker; - worker->work = req; - return reinterpret_cast(worker); -} - -void napi_delete_async_work(napi_work w) { - napi_work_impl* worker = reinterpret_cast(w); - if (worker != NULL) { - if (worker->work != NULL) { - delete reinterpret_cast(worker->work); - } - delete worker; - worker = NULL; - } -} - -void napi_async_set_data(napi_work w, void* data) { - napi_work_impl* worker = reinterpret_cast(w); - worker->data = data; -} - -void napi_async_set_execute(napi_work w, void (*execute)(void* data)) { - napi_work_impl* worker = reinterpret_cast(w); - worker->execute = execute; -} - -void napi_async_set_complete(napi_work w, void (*complete)(void* data)) { - napi_work_impl* worker = reinterpret_cast(w); - worker->complete = complete; -} - -void napi_async_set_destroy(napi_work w, void (*destroy)(void* data)) { - napi_work_impl* worker = reinterpret_cast(w); - worker->destroy = destroy; -} - -void napi_async_execute(uv_work_t* req) { - napi_work_impl* worker = static_cast(req->data); - worker->execute(worker->data); -} - -void napi_async_complete(uv_work_t* req) { - napi_work_impl* worker = static_cast(req->data); - worker->complete(worker->data); - worker->destroy(worker->data); -} - -void napi_async_queue_worker(napi_work w) { - napi_work_impl* worker = reinterpret_cast(w); - uv_queue_work(uv_default_loop(), - worker->work, - napi_async_execute, - reinterpret_cast(napi_async_complete)); -} diff --git a/src/node_api_async.h b/src/node_api_async.h deleted file mode 100644 index 83a5f38355..0000000000 --- a/src/node_api_async.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SRC_NODE_API_ASYNC_H_ -#define SRC_NODE_API_ASYNC_H_ - -#include -#include "node_api.h" -#include "node_api_async_types.h" - -EXTERN_C_START - -NAPI_EXTERN napi_work napi_create_async_work(); -NAPI_EXTERN void napi_delete_async_work(napi_work w); -NAPI_EXTERN void napi_async_set_data(napi_work w, void* data); -NAPI_EXTERN void napi_async_set_execute(napi_work w, void (*execute)(void*)); -NAPI_EXTERN void napi_async_set_complete(napi_work w, void (*complete)(void*)); -NAPI_EXTERN void napi_async_set_destroy(napi_work w, void (*destroy)(void*)); -NAPI_EXTERN void napi_async_queue_worker(napi_work w); - -EXTERN_C_END - -#endif // SRC_NODE_API_ASYNC_H_ diff --git a/src/node_api_async_types.h b/src/node_api_async_types.h deleted file mode 100644 index 44e0671c3a..0000000000 --- a/src/node_api_async_types.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SRC_NODE_API_ASYNC_TYPES_H_ -#define SRC_NODE_API_ASYNC_TYPES_H_ - -// LIBUV API types are all opaque pointers for ABI stability -// typedef undefined structs instead of void* for compile time type safety -typedef struct napi_uv_work_t__ *napi_work; - -#endif // SRC_NODE_API_ASYNC_TYPES_H_ diff --git a/tools/install.py b/tools/install.py index 145ceb4c9c..2f4c5e1edf 100755 --- a/tools/install.py +++ b/tools/install.py @@ -150,8 +150,6 @@ def headers(action): 'src/node.h', 'src/node_api.h', 'src/node_api_types.h', - 'src/node_api_async.h', - 'src/node_api_async_types.h', 'src/node_buffer.h', 'src/node_object_wrap.h', 'src/node_version.h',