emnapi 1.1.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +27 -5
- package/README.md +39 -11
- package/common.gypi +4 -4
- package/dist/library_napi.js +56 -35
- package/emnapi.gyp +4 -1
- package/include/node/emnapi.h +2 -2
- package/include/node/js_native_api.h +30 -25
- package/include/node/js_native_api_types.h +13 -9
- package/include/node/node_api.h +13 -13
- package/include/node/uv/threadpool.h +1 -1
- package/include/node/uv/unix.h +4 -0
- package/include/node/uv.h +49 -6
- package/lib/wasm32/libdlmalloc-mt.a +0 -0
- package/lib/wasm32/libdlmalloc.a +0 -0
- package/lib/wasm32/libemmalloc-mt.a +0 -0
- package/lib/wasm32/libemmalloc.a +0 -0
- package/lib/wasm32/libemnapi-basic-mt.a +0 -0
- package/lib/wasm32/libemnapi-basic.a +0 -0
- package/lib/wasm32/libemnapi.a +0 -0
- package/lib/wasm32-emscripten/libemnapi-basic.a +0 -0
- package/lib/wasm32-emscripten/libemnapi-mt.a +0 -0
- package/lib/wasm32-emscripten/libemnapi.a +0 -0
- package/lib/wasm32-wasi/libemnapi-basic-mt.a +0 -0
- package/lib/wasm32-wasi/libemnapi-basic.a +0 -0
- package/lib/wasm32-wasi/libemnapi.a +0 -0
- package/lib/wasm32-wasi-threads/libemnapi-basic-mt.a +0 -0
- package/lib/wasm32-wasi-threads/libemnapi-basic.a +0 -0
- package/lib/wasm32-wasi-threads/libemnapi-mt.a +0 -0
- package/lib/wasm32-wasi-threads/libemnapi.a +0 -0
- package/lib/wasm32-wasip1/libemnapi-basic-mt.a +0 -0
- package/lib/wasm32-wasip1/libemnapi-basic.a +0 -0
- package/lib/wasm32-wasip1/libemnapi.a +0 -0
- package/lib/wasm32-wasip1-threads/libemnapi-basic-mt.a +0 -0
- package/lib/wasm32-wasip1-threads/libemnapi-basic.a +0 -0
- package/lib/wasm32-wasip1-threads/libemnapi-mt.a +0 -0
- package/lib/wasm32-wasip1-threads/libemnapi.a +0 -0
- package/lib/wasm64-emscripten/libemnapi-basic.a +0 -0
- package/lib/wasm64-emscripten/libemnapi-mt.a +0 -0
- package/lib/wasm64-emscripten/libemnapi.a +0 -0
- package/package.json +1 -1
- package/src/async_cleanup_hook.c +1 -1
- package/src/async_work.c +2 -2
- package/src/emnapi_internal.h +2 -2
- package/src/js_native_api.c +2 -1
- package/src/node_api.c +5 -5
- package/src/threadsafe_function.c +20 -21
- package/src/uv/queue.h +68 -86
- package/src/uv/threadpool.c +58 -40
- package/src/uv/unix/async.c +67 -64
- package/src/uv/unix/core.c +36 -1
- package/src/uv/unix/internal.h +54 -0
- package/src/uv/unix/loop.c +40 -4
- package/src/uv/unix/posix-hrtime.c +40 -0
- package/src/uv/uv-common.c +123 -7
- package/src/uv/uv-common.h +137 -9
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
EXTERN_C_START
|
|
57
57
|
|
|
58
58
|
NAPI_EXTERN napi_status NAPI_CDECL napi_get_last_error_info(
|
|
59
|
-
|
|
59
|
+
node_api_basic_env env, const napi_extended_error_info** result);
|
|
60
60
|
|
|
61
61
|
// Getters for defined singletons
|
|
62
62
|
NAPI_EXTERN napi_status NAPI_CDECL napi_get_undefined(napi_env env,
|
|
@@ -100,19 +100,19 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env,
|
|
|
100
100
|
napi_value* result);
|
|
101
101
|
#ifdef NAPI_EXPERIMENTAL
|
|
102
102
|
#define NODE_API_EXPERIMENTAL_HAS_EXTERNAL_STRINGS
|
|
103
|
-
NAPI_EXTERN napi_status NAPI_CDECL
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
NAPI_EXTERN napi_status NAPI_CDECL node_api_create_external_string_latin1(
|
|
104
|
+
napi_env env,
|
|
105
|
+
char* str,
|
|
106
|
+
size_t length,
|
|
107
|
+
node_api_basic_finalize finalize_callback,
|
|
108
|
+
void* finalize_hint,
|
|
109
|
+
napi_value* result,
|
|
110
|
+
bool* copied);
|
|
111
111
|
NAPI_EXTERN napi_status NAPI_CDECL
|
|
112
112
|
node_api_create_external_string_utf16(napi_env env,
|
|
113
113
|
char16_t* str,
|
|
114
114
|
size_t length,
|
|
115
|
-
|
|
115
|
+
node_api_basic_finalize finalize_callback,
|
|
116
116
|
void* finalize_hint,
|
|
117
117
|
napi_value* result,
|
|
118
118
|
bool* copied);
|
|
@@ -120,6 +120,10 @@ node_api_create_external_string_utf16(napi_env env,
|
|
|
120
120
|
|
|
121
121
|
#ifdef NAPI_EXPERIMENTAL
|
|
122
122
|
#define NODE_API_EXPERIMENTAL_HAS_PROPERTY_KEYS
|
|
123
|
+
NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_latin1(
|
|
124
|
+
napi_env env, const char* str, size_t length, napi_value* result);
|
|
125
|
+
NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_utf8(
|
|
126
|
+
napi_env env, const char* str, size_t length, napi_value* result);
|
|
123
127
|
NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_utf16(
|
|
124
128
|
napi_env env, const char16_t* str, size_t length, napi_value* result);
|
|
125
129
|
#endif // NAPI_EXPERIMENTAL
|
|
@@ -324,12 +328,13 @@ napi_define_class(napi_env env,
|
|
|
324
328
|
napi_value* result);
|
|
325
329
|
|
|
326
330
|
// Methods to work with external data objects
|
|
327
|
-
NAPI_EXTERN napi_status NAPI_CDECL
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
NAPI_EXTERN napi_status NAPI_CDECL
|
|
332
|
+
napi_wrap(napi_env env,
|
|
333
|
+
napi_value js_object,
|
|
334
|
+
void* native_object,
|
|
335
|
+
node_api_basic_finalize finalize_cb,
|
|
336
|
+
void* finalize_hint,
|
|
337
|
+
napi_ref* result);
|
|
333
338
|
NAPI_EXTERN napi_status NAPI_CDECL napi_unwrap(napi_env env,
|
|
334
339
|
napi_value js_object,
|
|
335
340
|
void** result);
|
|
@@ -339,7 +344,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_remove_wrap(napi_env env,
|
|
|
339
344
|
NAPI_EXTERN napi_status NAPI_CDECL
|
|
340
345
|
napi_create_external(napi_env env,
|
|
341
346
|
void* data,
|
|
342
|
-
|
|
347
|
+
node_api_basic_finalize finalize_cb,
|
|
343
348
|
void* finalize_hint,
|
|
344
349
|
napi_value* result);
|
|
345
350
|
NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_external(napi_env env,
|
|
@@ -438,7 +443,7 @@ NAPI_EXTERN napi_status NAPI_CDECL
|
|
|
438
443
|
napi_create_external_arraybuffer(napi_env env,
|
|
439
444
|
void* external_data,
|
|
440
445
|
size_t byte_length,
|
|
441
|
-
|
|
446
|
+
node_api_basic_finalize finalize_cb,
|
|
442
447
|
void* finalize_hint,
|
|
443
448
|
napi_value* result);
|
|
444
449
|
#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
|
|
@@ -480,7 +485,7 @@ napi_get_dataview_info(napi_env env,
|
|
|
480
485
|
size_t* byte_offset);
|
|
481
486
|
|
|
482
487
|
// version management
|
|
483
|
-
NAPI_EXTERN napi_status NAPI_CDECL napi_get_version(
|
|
488
|
+
NAPI_EXTERN napi_status NAPI_CDECL napi_get_version(node_api_basic_env env,
|
|
484
489
|
uint32_t* result);
|
|
485
490
|
|
|
486
491
|
// Promises
|
|
@@ -504,7 +509,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_run_script(napi_env env,
|
|
|
504
509
|
|
|
505
510
|
// Memory management
|
|
506
511
|
NAPI_EXTERN napi_status NAPI_CDECL napi_adjust_external_memory(
|
|
507
|
-
|
|
512
|
+
node_api_basic_env env, int64_t change_in_bytes, int64_t* adjusted_value);
|
|
508
513
|
|
|
509
514
|
#if NAPI_VERSION >= 5
|
|
510
515
|
|
|
@@ -526,7 +531,7 @@ NAPI_EXTERN napi_status NAPI_CDECL
|
|
|
526
531
|
napi_add_finalizer(napi_env env,
|
|
527
532
|
napi_value js_object,
|
|
528
533
|
void* finalize_data,
|
|
529
|
-
|
|
534
|
+
node_api_basic_finalize finalize_cb,
|
|
530
535
|
void* finalize_hint,
|
|
531
536
|
napi_ref* result);
|
|
532
537
|
|
|
@@ -536,7 +541,7 @@ napi_add_finalizer(napi_env env,
|
|
|
536
541
|
#define NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER
|
|
537
542
|
|
|
538
543
|
NAPI_EXTERN napi_status NAPI_CDECL
|
|
539
|
-
node_api_post_finalizer(
|
|
544
|
+
node_api_post_finalizer(node_api_basic_env env,
|
|
540
545
|
napi_finalize finalize_cb,
|
|
541
546
|
void* finalize_data,
|
|
542
547
|
void* finalize_hint);
|
|
@@ -581,13 +586,13 @@ napi_get_all_property_names(napi_env env,
|
|
|
581
586
|
|
|
582
587
|
// Instance data
|
|
583
588
|
NAPI_EXTERN napi_status NAPI_CDECL
|
|
584
|
-
napi_set_instance_data(
|
|
589
|
+
napi_set_instance_data(node_api_basic_env env,
|
|
585
590
|
void* data,
|
|
586
591
|
napi_finalize finalize_cb,
|
|
587
592
|
void* finalize_hint);
|
|
588
593
|
|
|
589
|
-
NAPI_EXTERN napi_status NAPI_CDECL
|
|
590
|
-
|
|
594
|
+
NAPI_EXTERN napi_status NAPI_CDECL
|
|
595
|
+
napi_get_instance_data(node_api_basic_env env, void** data);
|
|
591
596
|
#endif // NAPI_VERSION >= 6
|
|
592
597
|
|
|
593
598
|
#if NAPI_VERSION >= 7
|
|
@@ -27,7 +27,7 @@ typedef struct napi_env__* napi_env;
|
|
|
27
27
|
// meaning that they do not affect the state of the JS engine, and can
|
|
28
28
|
// therefore be called synchronously from a finalizer that itself runs
|
|
29
29
|
// synchronously during GC. Such APIs can receive either a `napi_env` or a
|
|
30
|
-
// `
|
|
30
|
+
// `node_api_basic_env` as their first parameter, because we should be able to
|
|
31
31
|
// also call them during normal, non-garbage-collecting operations, whereas
|
|
32
32
|
// APIs that affect the state of the JS engine can only receive a `napi_env` as
|
|
33
33
|
// their first parameter, because we must not call them during GC. In lieu of
|
|
@@ -37,19 +37,21 @@ typedef struct napi_env__* napi_env;
|
|
|
37
37
|
// expecting a non-const value.
|
|
38
38
|
//
|
|
39
39
|
// In conjunction with appropriate CFLAGS to warn us if we're passing a const
|
|
40
|
-
// (
|
|
41
|
-
// definition of
|
|
42
|
-
//
|
|
43
|
-
// (unless the user explicitly casts the environment), we achieve
|
|
44
|
-
// to ensure at compile time that we do not call APIs that affect
|
|
45
|
-
// the JS engine from a synchronous (
|
|
40
|
+
// (basic) environment into an API that expects a non-const environment, and
|
|
41
|
+
// the definition of basic finalizer function pointer types below, which
|
|
42
|
+
// receive a basic environment as their first parameter, and can thus only call
|
|
43
|
+
// basic APIs (unless the user explicitly casts the environment), we achieve
|
|
44
|
+
// the ability to ensure at compile time that we do not call APIs that affect
|
|
45
|
+
// the state of the JS engine from a synchronous (basic) finalizer.
|
|
46
46
|
#if !defined(NAPI_EXPERIMENTAL) || \
|
|
47
47
|
(defined(NAPI_EXPERIMENTAL) && \
|
|
48
|
-
defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT)
|
|
48
|
+
(defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT) || \
|
|
49
|
+
defined(NODE_API_EXPERIMENTAL_BASIC_ENV_OPT_OUT)))
|
|
49
50
|
typedef struct napi_env__* node_api_nogc_env;
|
|
50
51
|
#else
|
|
51
52
|
typedef const struct napi_env__* node_api_nogc_env;
|
|
52
53
|
#endif
|
|
54
|
+
typedef node_api_nogc_env node_api_basic_env;
|
|
53
55
|
|
|
54
56
|
typedef struct napi_value__* napi_value;
|
|
55
57
|
typedef struct napi_ref__* napi_ref;
|
|
@@ -147,13 +149,15 @@ typedef void(NAPI_CDECL* napi_finalize)(napi_env env,
|
|
|
147
149
|
|
|
148
150
|
#if !defined(NAPI_EXPERIMENTAL) || \
|
|
149
151
|
(defined(NAPI_EXPERIMENTAL) && \
|
|
150
|
-
defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT)
|
|
152
|
+
(defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT) || \
|
|
153
|
+
defined(NODE_API_EXPERIMENTAL_BASIC_ENV_OPT_OUT)))
|
|
151
154
|
typedef napi_finalize node_api_nogc_finalize;
|
|
152
155
|
#else
|
|
153
156
|
typedef void(NAPI_CDECL* node_api_nogc_finalize)(node_api_nogc_env env,
|
|
154
157
|
void* finalize_data,
|
|
155
158
|
void* finalize_hint);
|
|
156
159
|
#endif
|
|
160
|
+
typedef node_api_nogc_finalize node_api_basic_finalize;
|
|
157
161
|
|
|
158
162
|
typedef struct {
|
|
159
163
|
// One of utf8name or name should be NULL.
|
package/include/node/node_api.h
CHANGED
|
@@ -141,7 +141,7 @@ NAPI_EXTERN napi_status NAPI_CDECL
|
|
|
141
141
|
napi_create_external_buffer(napi_env env,
|
|
142
142
|
size_t length,
|
|
143
143
|
void* data,
|
|
144
|
-
|
|
144
|
+
node_api_basic_finalize finalize_cb,
|
|
145
145
|
void* finalize_hint,
|
|
146
146
|
napi_value* result);
|
|
147
147
|
#endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
|
|
@@ -169,20 +169,20 @@ napi_create_async_work(napi_env env,
|
|
|
169
169
|
napi_async_work* result);
|
|
170
170
|
NAPI_EXTERN napi_status NAPI_CDECL napi_delete_async_work(napi_env env,
|
|
171
171
|
napi_async_work work);
|
|
172
|
-
NAPI_EXTERN napi_status NAPI_CDECL napi_queue_async_work(
|
|
172
|
+
NAPI_EXTERN napi_status NAPI_CDECL napi_queue_async_work(node_api_basic_env env,
|
|
173
173
|
napi_async_work work);
|
|
174
|
-
NAPI_EXTERN napi_status NAPI_CDECL
|
|
175
|
-
|
|
174
|
+
NAPI_EXTERN napi_status NAPI_CDECL
|
|
175
|
+
napi_cancel_async_work(node_api_basic_env env, napi_async_work work);
|
|
176
176
|
|
|
177
177
|
// version management
|
|
178
|
-
NAPI_EXTERN napi_status NAPI_CDECL
|
|
179
|
-
|
|
178
|
+
NAPI_EXTERN napi_status NAPI_CDECL napi_get_node_version(
|
|
179
|
+
node_api_basic_env env, const napi_node_version** version);
|
|
180
180
|
|
|
181
181
|
#if NAPI_VERSION >= 2
|
|
182
182
|
|
|
183
183
|
// Return the current libuv event loop for a given environment
|
|
184
184
|
NAPI_EXTERN napi_status NAPI_CDECL
|
|
185
|
-
napi_get_uv_event_loop(
|
|
185
|
+
napi_get_uv_event_loop(node_api_basic_env env, struct uv_loop_s** loop);
|
|
186
186
|
|
|
187
187
|
#endif // NAPI_VERSION >= 2
|
|
188
188
|
|
|
@@ -192,10 +192,10 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_fatal_exception(napi_env env,
|
|
|
192
192
|
napi_value err);
|
|
193
193
|
|
|
194
194
|
NAPI_EXTERN napi_status NAPI_CDECL napi_add_env_cleanup_hook(
|
|
195
|
-
|
|
195
|
+
node_api_basic_env env, napi_cleanup_hook fun, void* arg);
|
|
196
196
|
|
|
197
197
|
NAPI_EXTERN napi_status NAPI_CDECL napi_remove_env_cleanup_hook(
|
|
198
|
-
|
|
198
|
+
node_api_basic_env env, napi_cleanup_hook fun, void* arg);
|
|
199
199
|
|
|
200
200
|
NAPI_EXTERN napi_status NAPI_CDECL
|
|
201
201
|
napi_open_callback_scope(napi_env env,
|
|
@@ -239,17 +239,17 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_release_threadsafe_function(
|
|
|
239
239
|
napi_threadsafe_function func, napi_threadsafe_function_release_mode mode);
|
|
240
240
|
|
|
241
241
|
NAPI_EXTERN napi_status NAPI_CDECL napi_unref_threadsafe_function(
|
|
242
|
-
|
|
242
|
+
node_api_basic_env env, napi_threadsafe_function func);
|
|
243
243
|
|
|
244
244
|
NAPI_EXTERN napi_status NAPI_CDECL napi_ref_threadsafe_function(
|
|
245
|
-
|
|
245
|
+
node_api_basic_env env, napi_threadsafe_function func);
|
|
246
246
|
|
|
247
247
|
#endif // NAPI_VERSION >= 4
|
|
248
248
|
|
|
249
249
|
#if NAPI_VERSION >= 8
|
|
250
250
|
|
|
251
251
|
NAPI_EXTERN napi_status NAPI_CDECL
|
|
252
|
-
napi_add_async_cleanup_hook(
|
|
252
|
+
napi_add_async_cleanup_hook(node_api_basic_env env,
|
|
253
253
|
napi_async_cleanup_hook hook,
|
|
254
254
|
void* arg,
|
|
255
255
|
napi_async_cleanup_hook_handle* remove_handle);
|
|
@@ -262,7 +262,7 @@ napi_remove_async_cleanup_hook(napi_async_cleanup_hook_handle remove_handle);
|
|
|
262
262
|
#if NAPI_VERSION >= 9
|
|
263
263
|
|
|
264
264
|
NAPI_EXTERN napi_status NAPI_CDECL
|
|
265
|
-
node_api_get_module_file_name(
|
|
265
|
+
node_api_get_module_file_name(node_api_basic_env env, const char** result);
|
|
266
266
|
|
|
267
267
|
#endif // NAPI_VERSION >= 9
|
|
268
268
|
|
package/include/node/uv/unix.h
CHANGED
package/include/node/uv.h
CHANGED
|
@@ -3,13 +3,21 @@
|
|
|
3
3
|
|
|
4
4
|
#if defined(__EMSCRIPTEN_PTHREADS__) || defined(_REENTRANT)
|
|
5
5
|
|
|
6
|
-
#include <stddef.h>
|
|
7
|
-
#include "uv/unix.h"
|
|
8
|
-
|
|
9
6
|
#ifdef __cplusplus
|
|
10
7
|
extern "C" {
|
|
11
8
|
#endif
|
|
12
9
|
|
|
10
|
+
#include <stddef.h>
|
|
11
|
+
#include <stdint.h>
|
|
12
|
+
|
|
13
|
+
/* Internal type, do not use. */
|
|
14
|
+
struct uv__queue {
|
|
15
|
+
struct uv__queue* next;
|
|
16
|
+
struct uv__queue* prev;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
#include "uv/unix.h"
|
|
20
|
+
|
|
13
21
|
#define UV_EXTERN /* nothing */
|
|
14
22
|
|
|
15
23
|
typedef enum {
|
|
@@ -29,6 +37,8 @@ typedef struct uv_work_s uv_work_t;
|
|
|
29
37
|
typedef struct uv_handle_s uv_handle_t;
|
|
30
38
|
typedef struct uv_async_s uv_async_t;
|
|
31
39
|
|
|
40
|
+
typedef struct uv_metrics_s uv_metrics_t;
|
|
41
|
+
|
|
32
42
|
typedef void (*uv_work_cb)(uv_work_t* req);
|
|
33
43
|
typedef void (*uv_after_work_cb)(uv_work_t* req, int status);
|
|
34
44
|
|
|
@@ -40,10 +50,22 @@ struct uv_req_s {
|
|
|
40
50
|
UV_REQ_FIELDS
|
|
41
51
|
};
|
|
42
52
|
|
|
53
|
+
typedef void* (*uv_malloc_func)(size_t size);
|
|
54
|
+
typedef void* (*uv_realloc_func)(void* ptr, size_t size);
|
|
55
|
+
typedef void* (*uv_calloc_func)(size_t count, size_t size);
|
|
56
|
+
typedef void (*uv_free_func)(void* ptr);
|
|
57
|
+
|
|
43
58
|
UV_EXTERN void uv_library_shutdown(void);
|
|
59
|
+
|
|
60
|
+
UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func,
|
|
61
|
+
uv_realloc_func realloc_func,
|
|
62
|
+
uv_calloc_func calloc_func,
|
|
63
|
+
uv_free_func free_func);
|
|
64
|
+
|
|
44
65
|
UV_EXTERN uv_loop_t* uv_default_loop(void);
|
|
45
66
|
UV_EXTERN int uv_loop_init(uv_loop_t* loop);
|
|
46
67
|
UV_EXTERN int uv_loop_close(uv_loop_t* loop);
|
|
68
|
+
UV_EXTERN uint64_t uv_hrtime(void);
|
|
47
69
|
UV_EXTERN void uv_sleep(unsigned int msec);
|
|
48
70
|
|
|
49
71
|
UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value);
|
|
@@ -111,6 +133,12 @@ typedef void (*uv_async_cb)(uv_async_t* handle);
|
|
|
111
133
|
uv_loop_t* loop; \
|
|
112
134
|
uv_handle_type type; \
|
|
113
135
|
uv_close_cb close_cb; \
|
|
136
|
+
struct uv__queue handle_queue; \
|
|
137
|
+
union { \
|
|
138
|
+
int fd; \
|
|
139
|
+
void* reserved[4]; \
|
|
140
|
+
} u; \
|
|
141
|
+
UV_HANDLE_PRIVATE_FIELDS \
|
|
114
142
|
|
|
115
143
|
struct uv_handle_s {
|
|
116
144
|
UV_HANDLE_FIELDS
|
|
@@ -119,7 +147,7 @@ struct uv_handle_s {
|
|
|
119
147
|
struct uv_async_s {
|
|
120
148
|
UV_HANDLE_FIELDS
|
|
121
149
|
uv_async_cb async_cb;
|
|
122
|
-
|
|
150
|
+
struct uv__queue queue;
|
|
123
151
|
int pending;
|
|
124
152
|
};
|
|
125
153
|
|
|
@@ -129,18 +157,33 @@ UV_EXTERN int uv_async_init(uv_loop_t*,
|
|
|
129
157
|
UV_EXTERN int uv_async_send(uv_async_t* async);
|
|
130
158
|
|
|
131
159
|
UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
|
|
160
|
+
UV_EXTERN int uv_is_closing(const uv_handle_t* handle);
|
|
161
|
+
|
|
162
|
+
struct uv_metrics_s {
|
|
163
|
+
uint64_t loop_count;
|
|
164
|
+
uint64_t events;
|
|
165
|
+
uint64_t events_waiting;
|
|
166
|
+
/* private */
|
|
167
|
+
uint64_t* reserved[13];
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
UV_EXTERN int uv_metrics_info(uv_loop_t* loop, uv_metrics_t* metrics);
|
|
171
|
+
UV_EXTERN uint64_t uv_metrics_idle_time(uv_loop_t* loop);
|
|
132
172
|
|
|
133
173
|
struct uv_loop_s {
|
|
134
174
|
void* data;
|
|
175
|
+
unsigned int active_handles;
|
|
176
|
+
struct uv__queue handle_queue;
|
|
135
177
|
union {
|
|
136
178
|
void* unused;
|
|
137
179
|
unsigned int count;
|
|
138
180
|
} active_reqs;
|
|
139
|
-
void*
|
|
181
|
+
void* internal_fields;
|
|
140
182
|
|
|
183
|
+
struct uv__queue wq;
|
|
141
184
|
uv_mutex_t wq_mutex;
|
|
142
185
|
uv_async_t wq_async;
|
|
143
|
-
|
|
186
|
+
struct uv__queue async_handles;
|
|
144
187
|
void* em_queue;
|
|
145
188
|
};
|
|
146
189
|
|
|
Binary file
|
package/lib/wasm32/libdlmalloc.a
CHANGED
|
Binary file
|
|
Binary file
|
package/lib/wasm32/libemmalloc.a
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/wasm32/libemnapi.a
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/src/async_cleanup_hook.c
CHANGED
|
@@ -101,7 +101,7 @@ _emnapi_ach_handle_delete(napi_async_cleanup_hook_handle handle) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
napi_status
|
|
104
|
-
napi_add_async_cleanup_hook(
|
|
104
|
+
napi_add_async_cleanup_hook(node_api_basic_env env,
|
|
105
105
|
napi_async_cleanup_hook hook,
|
|
106
106
|
void* arg,
|
|
107
107
|
napi_async_cleanup_hook_handle* remove_handle) {
|
package/src/async_work.c
CHANGED
|
@@ -198,7 +198,7 @@ napi_status napi_delete_async_work(napi_env env, napi_async_work work) {
|
|
|
198
198
|
#endif
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
napi_status napi_queue_async_work(
|
|
201
|
+
napi_status napi_queue_async_work(node_api_basic_env env, napi_async_work work) {
|
|
202
202
|
#if EMNAPI_HAVE_THREADS
|
|
203
203
|
CHECK_ENV(env);
|
|
204
204
|
CHECK_ARG(env, work);
|
|
@@ -220,7 +220,7 @@ napi_status napi_queue_async_work(napi_env env, napi_async_work work) {
|
|
|
220
220
|
} \
|
|
221
221
|
} while (0)
|
|
222
222
|
|
|
223
|
-
napi_status napi_cancel_async_work(
|
|
223
|
+
napi_status napi_cancel_async_work(node_api_basic_env env, napi_async_work work) {
|
|
224
224
|
#if EMNAPI_HAVE_THREADS
|
|
225
225
|
CHECK_ENV(env);
|
|
226
226
|
CHECK_ARG(env, work);
|
package/src/emnapi_internal.h
CHANGED
|
@@ -72,11 +72,11 @@ EXTERN_C_END
|
|
|
72
72
|
|
|
73
73
|
EXTERN_C_START
|
|
74
74
|
|
|
75
|
-
EMNAPI_INTERNAL_EXTERN napi_status napi_set_last_error(
|
|
75
|
+
EMNAPI_INTERNAL_EXTERN napi_status napi_set_last_error(node_api_basic_env env,
|
|
76
76
|
napi_status error_code,
|
|
77
77
|
uint32_t engine_error_code,
|
|
78
78
|
void* engine_reserved);
|
|
79
|
-
EMNAPI_INTERNAL_EXTERN napi_status napi_clear_last_error(
|
|
79
|
+
EMNAPI_INTERNAL_EXTERN napi_status napi_clear_last_error(node_api_basic_env env);
|
|
80
80
|
|
|
81
81
|
#ifdef __EMSCRIPTEN__
|
|
82
82
|
#if __EMSCRIPTEN_major__ * 10000 + __EMSCRIPTEN_minor__ * 100 + __EMSCRIPTEN_tiny__ >= 30114 // NOLINT
|
package/src/js_native_api.c
CHANGED
|
@@ -35,8 +35,9 @@ EMNAPI_INTERNAL_EXTERN void _emnapi_get_last_error_info(napi_env env,
|
|
|
35
35
|
void** engine_reserved);
|
|
36
36
|
|
|
37
37
|
napi_status napi_get_last_error_info(
|
|
38
|
-
|
|
38
|
+
node_api_basic_env basic_env, const napi_extended_error_info** result) {
|
|
39
39
|
static napi_extended_error_info last_error;
|
|
40
|
+
napi_env env = (napi_env) basic_env;
|
|
40
41
|
CHECK_ENV(env);
|
|
41
42
|
CHECK_ARG(env, result);
|
|
42
43
|
|
package/src/node_api.c
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#include "node_api.h"
|
|
2
2
|
#include "emnapi_internal.h"
|
|
3
3
|
|
|
4
|
-
#if EMNAPI_HAVE_THREADS
|
|
4
|
+
#if EMNAPI_HAVE_THREADS && !defined(EMNAPI_DISABLE_UV)
|
|
5
5
|
#include "uv.h"
|
|
6
6
|
#endif
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@ EMNAPI_INTERNAL_EXTERN void _emnapi_get_node_version(uint32_t* major,
|
|
|
12
12
|
uint32_t* patch);
|
|
13
13
|
|
|
14
14
|
napi_status
|
|
15
|
-
napi_get_node_version(
|
|
15
|
+
napi_get_node_version(node_api_basic_env env,
|
|
16
16
|
const napi_node_version** version) {
|
|
17
17
|
CHECK_ENV(env);
|
|
18
18
|
CHECK_ARG(env, version);
|
|
@@ -29,9 +29,9 @@ napi_get_node_version(napi_env env,
|
|
|
29
29
|
return napi_clear_last_error(env);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
napi_status napi_get_uv_event_loop(
|
|
32
|
+
napi_status napi_get_uv_event_loop(node_api_basic_env env,
|
|
33
33
|
struct uv_loop_s** loop) {
|
|
34
|
-
#if EMNAPI_HAVE_THREADS
|
|
34
|
+
#if EMNAPI_HAVE_THREADS && !defined(EMNAPI_DISABLE_UV)
|
|
35
35
|
CHECK_ENV(env);
|
|
36
36
|
CHECK_ARG(env, loop);
|
|
37
37
|
// Though this is fake libuv loop
|
|
@@ -44,7 +44,7 @@ napi_status napi_get_uv_event_loop(napi_env env,
|
|
|
44
44
|
|
|
45
45
|
EMNAPI_INTERNAL_EXTERN int _emnapi_get_filename(napi_env env, char* buf, int len);
|
|
46
46
|
|
|
47
|
-
napi_status node_api_get_module_file_name(
|
|
47
|
+
napi_status node_api_get_module_file_name(node_api_basic_env env,
|
|
48
48
|
const char** result) {
|
|
49
49
|
CHECK_ENV(env);
|
|
50
50
|
CHECK_ARG(env, result);
|