@downdraft/native-mobile-android-arm64 0.0.0 → 0.1.1
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/README.md +7 -0
- package/include/node/cppgc/allocation.h +308 -0
- package/include/node/cppgc/common.h +28 -0
- package/include/node/cppgc/cross-thread-persistent.h +462 -0
- package/include/node/cppgc/custom-space.h +97 -0
- package/include/node/cppgc/default-platform.h +68 -0
- package/include/node/cppgc/explicit-management.h +100 -0
- package/include/node/cppgc/garbage-collected.h +114 -0
- package/include/node/cppgc/heap-consistency.h +309 -0
- package/include/node/cppgc/heap-handle.h +48 -0
- package/include/node/cppgc/heap-state.h +82 -0
- package/include/node/cppgc/heap-statistics.h +126 -0
- package/include/node/cppgc/heap.h +202 -0
- package/include/node/cppgc/internal/api-constants.h +75 -0
- package/include/node/cppgc/internal/atomic-entry-flag.h +48 -0
- package/include/node/cppgc/internal/base-page-handle.h +43 -0
- package/include/node/cppgc/internal/caged-heap-local-data.h +117 -0
- package/include/node/cppgc/internal/caged-heap.h +64 -0
- package/include/node/cppgc/internal/compiler-specific.h +46 -0
- package/include/node/cppgc/internal/conditional-stack-allocated.h +41 -0
- package/include/node/cppgc/internal/finalizer-trait.h +93 -0
- package/include/node/cppgc/internal/gc-info.h +150 -0
- package/include/node/cppgc/internal/logging.h +50 -0
- package/include/node/cppgc/internal/member-storage.h +305 -0
- package/include/node/cppgc/internal/name-trait.h +141 -0
- package/include/node/cppgc/internal/persistent-node.h +219 -0
- package/include/node/cppgc/internal/pointer-policies.h +280 -0
- package/include/node/cppgc/internal/write-barrier.h +487 -0
- package/include/node/cppgc/liveness-broker.h +78 -0
- package/include/node/cppgc/macros.h +56 -0
- package/include/node/cppgc/member.h +669 -0
- package/include/node/cppgc/name-provider.h +75 -0
- package/include/node/cppgc/object-size-trait.h +58 -0
- package/include/node/cppgc/persistent.h +376 -0
- package/include/node/cppgc/platform.h +174 -0
- package/include/node/cppgc/prefinalizer.h +75 -0
- package/include/node/cppgc/process-heap-statistics.h +36 -0
- package/include/node/cppgc/sentinel-pointer.h +39 -0
- package/include/node/cppgc/source-location.h +16 -0
- package/include/node/cppgc/tagged-member.h +114 -0
- package/include/node/cppgc/testing.h +106 -0
- package/include/node/cppgc/trace-trait.h +127 -0
- package/include/node/cppgc/type-traits.h +272 -0
- package/include/node/cppgc/visitor.h +534 -0
- package/include/node/js_native_api.h +634 -0
- package/include/node/js_native_api_types.h +244 -0
- package/include/node/libplatform/libplatform-export.h +29 -0
- package/include/node/libplatform/libplatform.h +112 -0
- package/include/node/libplatform/v8-tracing.h +343 -0
- package/include/node/node.h +1744 -0
- package/include/node/node_api.h +265 -0
- package/include/node/node_api_types.h +58 -0
- package/include/node/node_buffer.h +94 -0
- package/include/node/node_object_wrap.h +145 -0
- package/include/node/node_version.h +116 -0
- package/include/node/uv/aix.h +32 -0
- package/include/node/uv/bsd.h +34 -0
- package/include/node/uv/darwin.h +61 -0
- package/include/node/uv/errno.h +483 -0
- package/include/node/uv/linux.h +34 -0
- package/include/node/uv/os390.h +33 -0
- package/include/node/uv/posix.h +31 -0
- package/include/node/uv/sunos.h +44 -0
- package/include/node/uv/threadpool.h +37 -0
- package/include/node/uv/tree.h +521 -0
- package/include/node/uv/unix.h +509 -0
- package/include/node/uv/version.h +43 -0
- package/include/node/uv/win.h +698 -0
- package/include/node/uv.h +1994 -0
- package/include/node/v8-array-buffer.h +646 -0
- package/include/node/v8-callbacks.h +533 -0
- package/include/node/v8-container.h +183 -0
- package/include/node/v8-context.h +580 -0
- package/include/node/v8-cpp-heap-external.h +56 -0
- package/include/node/v8-cppgc.h +194 -0
- package/include/node/v8-data.h +96 -0
- package/include/node/v8-date.h +57 -0
- package/include/node/v8-debug.h +210 -0
- package/include/node/v8-embedder-heap.h +54 -0
- package/include/node/v8-embedder-state-scope.h +52 -0
- package/include/node/v8-exception.h +298 -0
- package/include/node/v8-extension.h +60 -0
- package/include/node/v8-external-memory-accounter.h +60 -0
- package/include/node/v8-external.h +73 -0
- package/include/node/v8-fast-api-calls.h +784 -0
- package/include/node/v8-forward.h +82 -0
- package/include/node/v8-function-callback.h +708 -0
- package/include/node/v8-function.h +148 -0
- package/include/node/v8-handle-base.h +155 -0
- package/include/node/v8-initialization.h +343 -0
- package/include/node/v8-inspector-protocol.h +13 -0
- package/include/node/v8-inspector.h +458 -0
- package/include/node/v8-internal.h +1827 -0
- package/include/node/v8-isolate.h +1925 -0
- package/include/node/v8-json.h +54 -0
- package/include/node/v8-local-handle.h +884 -0
- package/include/node/v8-locker.h +138 -0
- package/include/node/v8-maybe.h +185 -0
- package/include/node/v8-memory-span.h +273 -0
- package/include/node/v8-message.h +215 -0
- package/include/node/v8-metrics.h +273 -0
- package/include/node/v8-microtask-queue.h +152 -0
- package/include/node/v8-microtask.h +28 -0
- package/include/node/v8-object.h +1134 -0
- package/include/node/v8-persistent-handle.h +556 -0
- package/include/node/v8-platform.h +1552 -0
- package/include/node/v8-primitive-object.h +118 -0
- package/include/node/v8-primitive.h +1056 -0
- package/include/node/v8-profiler.h +1401 -0
- package/include/node/v8-promise.h +185 -0
- package/include/node/v8-proxy.h +49 -0
- package/include/node/v8-regexp.h +105 -0
- package/include/node/v8-sandbox.h +170 -0
- package/include/node/v8-script.h +996 -0
- package/include/node/v8-snapshot.h +302 -0
- package/include/node/v8-source-location.h +91 -0
- package/include/node/v8-statistics.h +246 -0
- package/include/node/v8-template.h +1096 -0
- package/include/node/v8-trace-categories.h +28 -0
- package/include/node/v8-traced-handle.h +420 -0
- package/include/node/v8-typed-array.h +386 -0
- package/include/node/v8-unwinder-state.h +30 -0
- package/include/node/v8-unwinder.h +146 -0
- package/include/node/v8-util.h +549 -0
- package/include/node/v8-value-serializer-version.h +24 -0
- package/include/node/v8-value-serializer.h +316 -0
- package/include/node/v8-value.h +674 -0
- package/include/node/v8-version-string.h +38 -0
- package/include/node/v8-version.h +20 -0
- package/include/node/v8-wasm-trap-handler-posix.h +31 -0
- package/include/node/v8-wasm-trap-handler-win.h +28 -0
- package/include/node/v8-wasm.h +325 -0
- package/include/node/v8-weak-callback-info.h +88 -0
- package/include/node/v8.h +88 -0
- package/include/node/v8config.h +1077 -0
- package/lib/libc++_shared.so +0 -0
- package/lib/libnode.so +4 -0
- package/package.json +23 -3
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
#ifndef SRC_JS_NATIVE_API_TYPES_H_
|
|
2
|
+
#define SRC_JS_NATIVE_API_TYPES_H_
|
|
3
|
+
|
|
4
|
+
// Use INT_MAX, this should only be consumed by the pre-processor anyway.
|
|
5
|
+
#define NAPI_VERSION_EXPERIMENTAL 2147483647
|
|
6
|
+
#ifndef NAPI_VERSION
|
|
7
|
+
#ifdef NAPI_EXPERIMENTAL
|
|
8
|
+
#define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL
|
|
9
|
+
#else
|
|
10
|
+
// The baseline version for Node-API.
|
|
11
|
+
// NAPI_VERSION controls which version is used by default when compiling
|
|
12
|
+
// a native addon. If the addon developer wants to use functions from a
|
|
13
|
+
// newer Node-API version not yet available in all LTS versions, they can
|
|
14
|
+
// set NAPI_VERSION to explicitly depend on that version.
|
|
15
|
+
#define NAPI_VERSION 8
|
|
16
|
+
#endif
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#if defined(NAPI_EXPERIMENTAL) && \
|
|
20
|
+
!defined(NODE_API_EXPERIMENTAL_NO_WARNING) && \
|
|
21
|
+
!defined(NODE_WANT_INTERNALS)
|
|
22
|
+
#ifdef _MSC_VER
|
|
23
|
+
#pragma message("NAPI_EXPERIMENTAL is enabled. " \
|
|
24
|
+
"Experimental features may be unstable.")
|
|
25
|
+
#else
|
|
26
|
+
#warning "NAPI_EXPERIMENTAL is enabled. " \
|
|
27
|
+
"Experimental features may be unstable."
|
|
28
|
+
#endif
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// This file needs to be compatible with C compilers.
|
|
32
|
+
// This is a public include file, and these includes have essentially
|
|
33
|
+
// become part of its API.
|
|
34
|
+
#include <stddef.h> // NOLINT(modernize-deprecated-headers)
|
|
35
|
+
#include <stdint.h> // NOLINT(modernize-deprecated-headers)
|
|
36
|
+
|
|
37
|
+
#if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900)
|
|
38
|
+
typedef uint16_t char16_t;
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#ifndef NAPI_CDECL
|
|
42
|
+
#ifdef _WIN32
|
|
43
|
+
#define NAPI_CDECL __cdecl
|
|
44
|
+
#else
|
|
45
|
+
#define NAPI_CDECL
|
|
46
|
+
#endif
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
// JSVM API types are all opaque pointers for ABI stability
|
|
50
|
+
// typedef undefined structs instead of void* for compile time type safety
|
|
51
|
+
typedef struct napi_env__* napi_env;
|
|
52
|
+
|
|
53
|
+
// We need to mark APIs which can be called during garbage collection (GC),
|
|
54
|
+
// meaning that they do not affect the state of the JS engine, and can
|
|
55
|
+
// therefore be called synchronously from a finalizer that itself runs
|
|
56
|
+
// synchronously during GC. Such APIs can receive either a `napi_env` or a
|
|
57
|
+
// `node_api_basic_env` as their first parameter, because we should be able to
|
|
58
|
+
// also call them during normal, non-garbage-collecting operations, whereas
|
|
59
|
+
// APIs that affect the state of the JS engine can only receive a `napi_env` as
|
|
60
|
+
// their first parameter, because we must not call them during GC. In lieu of
|
|
61
|
+
// inheritance, we use the properties of the const qualifier to accomplish
|
|
62
|
+
// this, because both a const and a non-const value can be passed to an API
|
|
63
|
+
// expecting a const value, but only a non-const value can be passed to an API
|
|
64
|
+
// expecting a non-const value.
|
|
65
|
+
//
|
|
66
|
+
// In conjunction with appropriate CFLAGS to warn us if we're passing a const
|
|
67
|
+
// (basic) environment into an API that expects a non-const environment, and
|
|
68
|
+
// the definition of basic finalizer function pointer types below, which
|
|
69
|
+
// receive a basic environment as their first parameter, and can thus only call
|
|
70
|
+
// basic APIs (unless the user explicitly casts the environment), we achieve
|
|
71
|
+
// the ability to ensure at compile time that we do not call APIs that affect
|
|
72
|
+
// the state of the JS engine from a synchronous (basic) finalizer.
|
|
73
|
+
#if !defined(NAPI_EXPERIMENTAL) || \
|
|
74
|
+
(defined(NAPI_EXPERIMENTAL) && \
|
|
75
|
+
(defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT) || \
|
|
76
|
+
defined(NODE_API_EXPERIMENTAL_BASIC_ENV_OPT_OUT)))
|
|
77
|
+
typedef struct napi_env__* node_api_nogc_env;
|
|
78
|
+
#else
|
|
79
|
+
typedef const struct napi_env__* node_api_nogc_env;
|
|
80
|
+
#endif
|
|
81
|
+
typedef node_api_nogc_env node_api_basic_env;
|
|
82
|
+
|
|
83
|
+
typedef struct napi_value__* napi_value;
|
|
84
|
+
typedef struct napi_ref__* napi_ref;
|
|
85
|
+
typedef struct napi_handle_scope__* napi_handle_scope;
|
|
86
|
+
typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope;
|
|
87
|
+
typedef struct napi_callback_info__* napi_callback_info;
|
|
88
|
+
typedef struct napi_deferred__* napi_deferred;
|
|
89
|
+
|
|
90
|
+
typedef enum {
|
|
91
|
+
napi_default = 0,
|
|
92
|
+
napi_writable = 1 << 0,
|
|
93
|
+
napi_enumerable = 1 << 1,
|
|
94
|
+
napi_configurable = 1 << 2,
|
|
95
|
+
|
|
96
|
+
// Used with napi_define_class to distinguish static properties
|
|
97
|
+
// from instance properties. Ignored by napi_define_properties.
|
|
98
|
+
napi_static = 1 << 10,
|
|
99
|
+
|
|
100
|
+
#if NAPI_VERSION >= 8
|
|
101
|
+
// Default for class methods.
|
|
102
|
+
napi_default_method = napi_writable | napi_configurable,
|
|
103
|
+
|
|
104
|
+
// Default for object properties, like in JS obj[prop].
|
|
105
|
+
napi_default_jsproperty = napi_writable | napi_enumerable | napi_configurable,
|
|
106
|
+
#endif // NAPI_VERSION >= 8
|
|
107
|
+
} napi_property_attributes;
|
|
108
|
+
|
|
109
|
+
typedef enum {
|
|
110
|
+
// ES6 types (corresponds to typeof)
|
|
111
|
+
napi_undefined,
|
|
112
|
+
napi_null,
|
|
113
|
+
napi_boolean,
|
|
114
|
+
napi_number,
|
|
115
|
+
napi_string,
|
|
116
|
+
napi_symbol,
|
|
117
|
+
napi_object,
|
|
118
|
+
napi_function,
|
|
119
|
+
napi_external,
|
|
120
|
+
napi_bigint,
|
|
121
|
+
} napi_valuetype;
|
|
122
|
+
|
|
123
|
+
typedef enum {
|
|
124
|
+
napi_int8_array,
|
|
125
|
+
napi_uint8_array,
|
|
126
|
+
napi_uint8_clamped_array,
|
|
127
|
+
napi_int16_array,
|
|
128
|
+
napi_uint16_array,
|
|
129
|
+
napi_int32_array,
|
|
130
|
+
napi_uint32_array,
|
|
131
|
+
napi_float32_array,
|
|
132
|
+
napi_float64_array,
|
|
133
|
+
napi_bigint64_array,
|
|
134
|
+
napi_biguint64_array,
|
|
135
|
+
#define NODE_API_HAS_FLOAT16_ARRAY
|
|
136
|
+
napi_float16_array,
|
|
137
|
+
} napi_typedarray_type;
|
|
138
|
+
|
|
139
|
+
typedef enum {
|
|
140
|
+
napi_ok,
|
|
141
|
+
napi_invalid_arg,
|
|
142
|
+
napi_object_expected,
|
|
143
|
+
napi_string_expected,
|
|
144
|
+
napi_name_expected,
|
|
145
|
+
napi_function_expected,
|
|
146
|
+
napi_number_expected,
|
|
147
|
+
napi_boolean_expected,
|
|
148
|
+
napi_array_expected,
|
|
149
|
+
napi_generic_failure,
|
|
150
|
+
napi_pending_exception,
|
|
151
|
+
napi_cancelled,
|
|
152
|
+
napi_escape_called_twice,
|
|
153
|
+
napi_handle_scope_mismatch,
|
|
154
|
+
napi_callback_scope_mismatch,
|
|
155
|
+
napi_queue_full,
|
|
156
|
+
napi_closing,
|
|
157
|
+
napi_bigint_expected,
|
|
158
|
+
napi_date_expected,
|
|
159
|
+
napi_arraybuffer_expected,
|
|
160
|
+
napi_detachable_arraybuffer_expected,
|
|
161
|
+
napi_would_deadlock, // unused
|
|
162
|
+
napi_no_external_buffers_allowed,
|
|
163
|
+
napi_cannot_run_js,
|
|
164
|
+
} napi_status;
|
|
165
|
+
// Note: when adding a new enum value to `napi_status`, please also update
|
|
166
|
+
// * `const int last_status` in the definition of `napi_get_last_error_info()'
|
|
167
|
+
// in file js_native_api_v8.cc.
|
|
168
|
+
// * `const char* error_messages[]` in file js_native_api_v8.cc with a brief
|
|
169
|
+
// message explaining the error.
|
|
170
|
+
// * the definition of `napi_status` in doc/api/n-api.md to reflect the newly
|
|
171
|
+
// added value(s).
|
|
172
|
+
|
|
173
|
+
typedef napi_value(NAPI_CDECL* napi_callback)(napi_env env,
|
|
174
|
+
napi_callback_info info);
|
|
175
|
+
typedef void(NAPI_CDECL* napi_finalize)(napi_env env,
|
|
176
|
+
void* finalize_data,
|
|
177
|
+
void* finalize_hint);
|
|
178
|
+
|
|
179
|
+
#if !defined(NAPI_EXPERIMENTAL) || \
|
|
180
|
+
(defined(NAPI_EXPERIMENTAL) && \
|
|
181
|
+
(defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT) || \
|
|
182
|
+
defined(NODE_API_EXPERIMENTAL_BASIC_ENV_OPT_OUT)))
|
|
183
|
+
typedef napi_finalize node_api_nogc_finalize;
|
|
184
|
+
#else
|
|
185
|
+
typedef void(NAPI_CDECL* node_api_nogc_finalize)(node_api_nogc_env env,
|
|
186
|
+
void* finalize_data,
|
|
187
|
+
void* finalize_hint);
|
|
188
|
+
#endif
|
|
189
|
+
typedef node_api_nogc_finalize node_api_basic_finalize;
|
|
190
|
+
|
|
191
|
+
// A finalizer that can be called from any thread and at any time.
|
|
192
|
+
typedef void(NAPI_CDECL* node_api_noenv_finalize)(void* finalize_data,
|
|
193
|
+
void* finalize_hint);
|
|
194
|
+
|
|
195
|
+
typedef struct {
|
|
196
|
+
// One of utf8name or name should be NULL.
|
|
197
|
+
const char* utf8name;
|
|
198
|
+
napi_value name;
|
|
199
|
+
|
|
200
|
+
napi_callback method;
|
|
201
|
+
napi_callback getter;
|
|
202
|
+
napi_callback setter;
|
|
203
|
+
napi_value value;
|
|
204
|
+
|
|
205
|
+
napi_property_attributes attributes;
|
|
206
|
+
void* data;
|
|
207
|
+
} napi_property_descriptor;
|
|
208
|
+
|
|
209
|
+
typedef struct {
|
|
210
|
+
const char* error_message;
|
|
211
|
+
void* engine_reserved;
|
|
212
|
+
uint32_t engine_error_code;
|
|
213
|
+
napi_status error_code;
|
|
214
|
+
} napi_extended_error_info;
|
|
215
|
+
|
|
216
|
+
#if NAPI_VERSION >= 6
|
|
217
|
+
typedef enum {
|
|
218
|
+
napi_key_include_prototypes,
|
|
219
|
+
napi_key_own_only
|
|
220
|
+
} napi_key_collection_mode;
|
|
221
|
+
|
|
222
|
+
typedef enum {
|
|
223
|
+
napi_key_all_properties = 0,
|
|
224
|
+
napi_key_writable = 1,
|
|
225
|
+
napi_key_enumerable = 1 << 1,
|
|
226
|
+
napi_key_configurable = 1 << 2,
|
|
227
|
+
napi_key_skip_strings = 1 << 3,
|
|
228
|
+
napi_key_skip_symbols = 1 << 4
|
|
229
|
+
} napi_key_filter;
|
|
230
|
+
|
|
231
|
+
typedef enum {
|
|
232
|
+
napi_key_keep_numbers,
|
|
233
|
+
napi_key_numbers_to_strings
|
|
234
|
+
} napi_key_conversion;
|
|
235
|
+
#endif // NAPI_VERSION >= 6
|
|
236
|
+
|
|
237
|
+
#if NAPI_VERSION >= 8
|
|
238
|
+
typedef struct {
|
|
239
|
+
uint64_t lower;
|
|
240
|
+
uint64_t upper;
|
|
241
|
+
} napi_type_tag;
|
|
242
|
+
#endif // NAPI_VERSION >= 8
|
|
243
|
+
|
|
244
|
+
#endif // SRC_JS_NATIVE_API_TYPES_H_
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_
|
|
6
|
+
#define V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_
|
|
7
|
+
|
|
8
|
+
#if defined(_WIN32)
|
|
9
|
+
|
|
10
|
+
#ifdef BUILDING_V8_PLATFORM_SHARED
|
|
11
|
+
#define V8_PLATFORM_EXPORT __declspec(dllexport)
|
|
12
|
+
#elif USING_V8_PLATFORM_SHARED
|
|
13
|
+
#define V8_PLATFORM_EXPORT __declspec(dllimport)
|
|
14
|
+
#else
|
|
15
|
+
#define V8_PLATFORM_EXPORT
|
|
16
|
+
#endif // BUILDING_V8_PLATFORM_SHARED
|
|
17
|
+
|
|
18
|
+
#else // defined(_WIN32)
|
|
19
|
+
|
|
20
|
+
// Setup for Linux shared library export.
|
|
21
|
+
#if defined(BUILDING_V8_PLATFORM_SHARED) || USING_V8_PLATFORM_SHARED
|
|
22
|
+
#define V8_PLATFORM_EXPORT __attribute__((visibility("default")))
|
|
23
|
+
#else
|
|
24
|
+
#define V8_PLATFORM_EXPORT
|
|
25
|
+
#endif // defined(BUILDING_V8_PLATFORM_SHARED) || ...
|
|
26
|
+
|
|
27
|
+
#endif // defined(_WIN32)
|
|
28
|
+
|
|
29
|
+
#endif // V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_
|
|
6
|
+
#define V8_LIBPLATFORM_LIBPLATFORM_H_
|
|
7
|
+
|
|
8
|
+
#include <memory>
|
|
9
|
+
|
|
10
|
+
#include "libplatform/libplatform-export.h"
|
|
11
|
+
#include "libplatform/v8-tracing.h"
|
|
12
|
+
#include "v8-platform.h" // NOLINT(build/include_directory)
|
|
13
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
14
|
+
|
|
15
|
+
namespace v8 {
|
|
16
|
+
namespace platform {
|
|
17
|
+
|
|
18
|
+
enum class IdleTaskSupport { kDisabled, kEnabled };
|
|
19
|
+
enum class InProcessStackDumping { kDisabled, kEnabled };
|
|
20
|
+
|
|
21
|
+
enum class MessageLoopBehavior : bool {
|
|
22
|
+
kDoNotWait = false,
|
|
23
|
+
kWaitForWork = true
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
enum class PriorityMode : bool { kDontApply, kApply };
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns a new instance of the default v8::Platform implementation.
|
|
30
|
+
*
|
|
31
|
+
* The caller will take ownership of the returned pointer. |thread_pool_size|
|
|
32
|
+
* is the number of worker threads to allocate for background jobs. If a value
|
|
33
|
+
* of zero is passed, a suitable default based on the current number of
|
|
34
|
+
* processors online will be chosen.
|
|
35
|
+
* If |idle_task_support| is enabled then the platform will accept idle
|
|
36
|
+
* tasks (IdleTasksEnabled will return true) and will rely on the embedder
|
|
37
|
+
* calling v8::platform::RunIdleTasks to process the idle tasks.
|
|
38
|
+
* If |tracing_controller| is nullptr, the default platform will create a
|
|
39
|
+
* v8::platform::TracingController instance and use it.
|
|
40
|
+
* If |priority_mode| is PriorityMode::kApply, the default platform will use
|
|
41
|
+
* multiple task queues executed by threads different system-level priorities
|
|
42
|
+
* (where available) to schedule tasks.
|
|
43
|
+
*/
|
|
44
|
+
V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform> NewDefaultPlatform(
|
|
45
|
+
int thread_pool_size = 0,
|
|
46
|
+
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
|
|
47
|
+
InProcessStackDumping in_process_stack_dumping =
|
|
48
|
+
InProcessStackDumping::kDisabled,
|
|
49
|
+
std::unique_ptr<v8::TracingController> tracing_controller = {},
|
|
50
|
+
PriorityMode priority_mode = PriorityMode::kDontApply);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The same as NewDefaultPlatform but disables the worker thread pool.
|
|
54
|
+
* It must be used with the --single-threaded V8 flag.
|
|
55
|
+
*/
|
|
56
|
+
V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform>
|
|
57
|
+
NewSingleThreadedDefaultPlatform(
|
|
58
|
+
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
|
|
59
|
+
InProcessStackDumping in_process_stack_dumping =
|
|
60
|
+
InProcessStackDumping::kDisabled,
|
|
61
|
+
std::unique_ptr<v8::TracingController> tracing_controller = {});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Returns a new instance of the default v8::JobHandle implementation.
|
|
65
|
+
*
|
|
66
|
+
* The job will be executed by spawning up to |num_worker_threads| many worker
|
|
67
|
+
* threads on the provided |platform| with the given |priority|.
|
|
68
|
+
*/
|
|
69
|
+
V8_PLATFORM_EXPORT std::unique_ptr<v8::JobHandle> NewDefaultJobHandle(
|
|
70
|
+
v8::Platform* platform, v8::TaskPriority priority,
|
|
71
|
+
std::unique_ptr<v8::JobTask> job_task, size_t num_worker_threads);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Pumps the message loop for the given isolate.
|
|
75
|
+
*
|
|
76
|
+
* The caller has to make sure that this is called from the right thread.
|
|
77
|
+
* Returns true if a task was executed, and false otherwise. If the call to
|
|
78
|
+
* PumpMessageLoop is nested within another call to PumpMessageLoop, only
|
|
79
|
+
* nestable tasks may run. Otherwise, any task may run. Unless requested through
|
|
80
|
+
* the |behavior| parameter, this call does not block if no task is pending. The
|
|
81
|
+
* |platform| has to be created using |NewDefaultPlatform|.
|
|
82
|
+
*/
|
|
83
|
+
V8_PLATFORM_EXPORT bool PumpMessageLoop(
|
|
84
|
+
v8::Platform* platform, v8::Isolate* isolate,
|
|
85
|
+
MessageLoopBehavior behavior = MessageLoopBehavior::kDoNotWait);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Runs pending idle tasks for at most |idle_time_in_seconds| seconds.
|
|
89
|
+
*
|
|
90
|
+
* The caller has to make sure that this is called from the right thread.
|
|
91
|
+
* This call does not block if no task is pending. The |platform| has to be
|
|
92
|
+
* created using |NewDefaultPlatform|.
|
|
93
|
+
*/
|
|
94
|
+
V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
|
95
|
+
v8::Isolate* isolate,
|
|
96
|
+
double idle_time_in_seconds);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Notifies the given platform about the Isolate getting deleted soon. Has to be
|
|
100
|
+
* called for all Isolates which are deleted - unless we're shutting down the
|
|
101
|
+
* platform.
|
|
102
|
+
*
|
|
103
|
+
* The |platform| has to be created using |NewDefaultPlatform|.
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
106
|
+
V8_PLATFORM_EXPORT void NotifyIsolateShutdown(v8::Platform* platform,
|
|
107
|
+
Isolate* isolate);
|
|
108
|
+
|
|
109
|
+
} // namespace platform
|
|
110
|
+
} // namespace v8
|
|
111
|
+
|
|
112
|
+
#endif // V8_LIBPLATFORM_LIBPLATFORM_H_
|