@encharm/cws 4.4.0 → 4.5.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.
Files changed (511) hide show
  1. package/dist/bindings/cws_darwin_arm64_node115.node +0 -0
  2. package/dist/bindings/cws_darwin_arm64_node127.node +0 -0
  3. package/dist/bindings/cws_linux_arm64_node115.node +0 -0
  4. package/dist/bindings/cws_linux_arm64_node127.node +0 -0
  5. package/dist/bindings/cws_linux_x64_node108.node +0 -0
  6. package/dist/bindings/cws_linux_x64_node115.node +0 -0
  7. package/dist/bindings/cws_linux_x64_node127.node +0 -0
  8. package/dist/bindings/cws_win32_x64_node108.node +0 -0
  9. package/dist/bindings/cws_win32_x64_node115.node +0 -0
  10. package/dist/bindings/cws_win32_x64_node127.node +0 -0
  11. package/dist/bindings/cws_win32_x64_node83.node +0 -0
  12. package/dist/bindings/cws_win32_x64_node93.node +0 -0
  13. package/package.json +1 -1
  14. package/src/Addon.h +20 -24
  15. package/src/Socket.h +0 -1
  16. package/src/headers/20/acorn_version.h +1 -1
  17. package/src/headers/20/connection_wrap.h +1 -0
  18. package/src/headers/20/crypto/crypto_keys.h +3 -0
  19. package/src/headers/20/crypto/crypto_tls.h +12 -3
  20. package/src/headers/20/crypto/crypto_util.h +3 -2
  21. package/src/headers/20/env_properties.h +3 -1
  22. package/src/headers/20/js_native_api.h +11 -1
  23. package/src/headers/20/js_native_api_v8.h +40 -3
  24. package/src/headers/20/js_native_api_v8_internals.h +6 -0
  25. package/src/headers/20/module_wrap.h +1 -1
  26. package/src/headers/20/node.h +2 -0
  27. package/src/headers/20/node_api.h +8 -7
  28. package/src/headers/20/node_constants.h +3 -0
  29. package/src/headers/20/node_contextify.h +24 -0
  30. package/src/headers/20/node_file-inl.h +32 -0
  31. package/src/headers/20/node_file.h +25 -12
  32. package/src/headers/20/node_options.h +9 -9
  33. package/src/headers/20/node_version.h +1 -1
  34. package/src/headers/20/permission/child_process_permission.h +2 -1
  35. package/src/headers/20/permission/fs_permission.h +11 -9
  36. package/src/headers/20/permission/inspector_permission.h +29 -0
  37. package/src/headers/20/permission/permission.h +4 -1
  38. package/src/headers/20/permission/permission_base.h +6 -2
  39. package/src/headers/20/permission/worker_permission.h +2 -1
  40. package/src/headers/20/undici_version.h +2 -2
  41. package/src/headers/22/acorn_version.h +6 -0
  42. package/src/headers/22/aliased_buffer-inl.h +243 -0
  43. package/src/headers/22/aliased_buffer.h +206 -0
  44. package/src/headers/{18 → 22}/async_wrap-inl.h +8 -6
  45. package/src/headers/{18 → 22}/async_wrap.h +65 -59
  46. package/src/headers/{16 → 22}/base_object-inl.h +57 -117
  47. package/src/headers/{18 → 22}/base_object.h +58 -30
  48. package/src/headers/22/base_object_types.h +74 -0
  49. package/src/headers/22/blob_serializer_deserializer-inl.h +385 -0
  50. package/src/headers/22/blob_serializer_deserializer.h +132 -0
  51. package/src/headers/{16 → 22}/callback_queue.h +1 -0
  52. package/src/headers/{16 → 22}/cares_wrap.h +27 -20
  53. package/src/headers/22/cjs_module_lexer_version.h +6 -0
  54. package/src/headers/22/cleanup_queue-inl.h +62 -0
  55. package/src/headers/22/cleanup_queue.h +85 -0
  56. package/src/headers/22/compile_cache.h +104 -0
  57. package/src/headers/{18 → 22}/crypto/crypto_clienthello.h +1 -1
  58. package/src/headers/{18 → 22}/crypto/crypto_context.h +31 -7
  59. package/src/headers/{18 → 22}/crypto/crypto_keys.h +118 -148
  60. package/src/headers/{18 → 22}/crypto/crypto_tls.h +20 -5
  61. package/src/headers/{18 → 22}/crypto/crypto_util.h +219 -263
  62. package/src/headers/22/crypto/ncrypto.h +752 -0
  63. package/src/headers/{16 → 22}/debug_utils-inl.h +15 -7
  64. package/src/headers/{18 → 22}/debug_utils.h +25 -19
  65. package/src/headers/22/encoding_binding.h +59 -0
  66. package/src/headers/{14 → 22}/env-inl.h +276 -409
  67. package/src/headers/22/env.h +1266 -0
  68. package/src/headers/22/env_properties.h +497 -0
  69. package/src/headers/{18 → 22}/handle_wrap.h +2 -0
  70. package/src/headers/{18 → 22}/histogram.h +88 -48
  71. package/src/headers/{16 → 22}/inspector_agent.h +17 -1
  72. package/src/headers/{16 → 22}/inspector_profiler.h +15 -13
  73. package/src/headers/{18 → 22}/js_native_api.h +78 -30
  74. package/src/headers/{18 → 22}/js_native_api_types.h +46 -1
  75. package/src/headers/{18 → 22}/js_native_api_v8.h +206 -161
  76. package/src/headers/{18 → 22}/js_native_api_v8_internals.h +6 -0
  77. package/src/headers/22/json_parser.h +40 -0
  78. package/src/headers/{16 → 22}/json_utils.h +19 -8
  79. package/src/headers/{18 → 22}/memory_tracker-inl.h +16 -13
  80. package/src/headers/{14 → 22}/memory_tracker.h +13 -8
  81. package/src/headers/{16 → 22}/module_wrap.h +49 -19
  82. package/src/headers/22/ncrypto/ncrypto.h +752 -0
  83. package/src/headers/{18 → 22}/node.h +465 -68
  84. package/src/headers/{18 → 22}/node_api.h +66 -81
  85. package/src/headers/{18 → 22}/node_api_internals.h +8 -4
  86. package/src/headers/{18 → 22}/node_api_types.h +5 -0
  87. package/src/headers/22/node_binding.h +154 -0
  88. package/src/headers/{18 → 22}/node_blob.h +46 -78
  89. package/src/headers/{18 → 22}/node_bob-inl.h +1 -2
  90. package/src/headers/{18 → 22}/node_bob.h +2 -6
  91. package/src/headers/{18 → 22}/node_buffer.h +1 -1
  92. package/src/headers/22/node_builtins.h +220 -0
  93. package/src/headers/{18 → 22}/node_constants.h +3 -5
  94. package/src/headers/22/node_context_data.h +168 -0
  95. package/src/headers/22/node_contextify.h +199 -0
  96. package/src/headers/{16 → 22}/node_crypto.h +1 -2
  97. package/src/headers/22/node_dotenv.h +45 -0
  98. package/src/headers/{18 → 22}/node_errors.h +86 -27
  99. package/src/headers/22/node_exit_code.h +54 -0
  100. package/src/headers/22/node_external_reference.h +249 -0
  101. package/src/headers/{18 → 22}/node_file-inl.h +127 -30
  102. package/src/headers/{16 → 22}/node_file.h +122 -11
  103. package/src/headers/{18 → 22}/node_http2.h +28 -11
  104. package/src/headers/{16 → 22}/node_http2_state.h +34 -25
  105. package/src/headers/{18 → 22}/node_http_common-inl.h +2 -1
  106. package/src/headers/{18 → 22}/node_http_common.h +56 -55
  107. package/src/headers/{16 → 22}/node_i18n.h +5 -18
  108. package/src/headers/{18 → 22}/node_internals.h +121 -59
  109. package/src/headers/{18 → 22}/node_main_instance.h +4 -31
  110. package/src/headers/{18 → 22}/node_messaging.h +27 -10
  111. package/src/headers/{18 → 22}/node_metadata.h +23 -1
  112. package/src/headers/{18 → 22}/node_options-inl.h +24 -11
  113. package/src/headers/{18 → 22}/node_options.h +124 -39
  114. package/src/headers/{18 → 22}/node_perf.h +0 -2
  115. package/src/headers/{18 → 22}/node_perf_common.h +20 -9
  116. package/src/headers/{18 → 22}/node_platform.h +11 -5
  117. package/src/headers/{18 → 22}/node_process.h +26 -14
  118. package/src/headers/22/node_realm-inl.h +145 -0
  119. package/src/headers/22/node_realm.h +184 -0
  120. package/src/headers/{16 → 22}/node_report.h +13 -17
  121. package/src/headers/{16 → 22}/node_revert.h +3 -3
  122. package/src/headers/{16 → 22}/node_root_certs.h +902 -461
  123. package/src/headers/22/node_sea.h +64 -0
  124. package/src/headers/22/node_shadow_realm.h +46 -0
  125. package/src/headers/22/node_snapshot_builder.h +57 -0
  126. package/src/headers/22/node_snapshotable.h +174 -0
  127. package/src/headers/{18 → 22}/node_sockaddr.h +2 -2
  128. package/src/headers/{16 → 22}/node_stat_watcher.h +2 -1
  129. package/src/headers/22/node_threadsafe_cow-inl.h +54 -0
  130. package/src/headers/22/node_threadsafe_cow.h +105 -0
  131. package/src/headers/22/node_union_bytes.h +81 -0
  132. package/src/headers/22/node_url.h +96 -0
  133. package/src/headers/22/node_v8.h +77 -0
  134. package/src/headers/{14 → 22}/node_v8_platform-inl.h +17 -6
  135. package/src/headers/{18 → 22}/node_version.h +20 -8
  136. package/src/headers/22/node_wasi.h +185 -0
  137. package/src/headers/{14 → 22}/node_watchdog.h +2 -0
  138. package/src/headers/{18 → 22}/node_worker.h +7 -2
  139. package/src/headers/22/permission/child_process_permission.h +31 -0
  140. package/src/headers/22/permission/fs_permission.h +167 -0
  141. package/src/headers/22/permission/inspector_permission.h +31 -0
  142. package/src/headers/22/permission/permission.h +99 -0
  143. package/src/headers/22/permission/permission_base.h +60 -0
  144. package/src/headers/22/permission/wasi_permission.h +31 -0
  145. package/src/headers/22/permission/worker_permission.h +31 -0
  146. package/src/headers/{16 → 22}/req_wrap-inl.h +7 -6
  147. package/src/headers/{14 → 22}/spawn_sync.h +3 -3
  148. package/src/headers/{18 → 22}/stream_base-inl.h +0 -135
  149. package/src/headers/{18 → 22}/stream_base.h +35 -16
  150. package/src/headers/{18 → 22}/stream_pipe.h +3 -4
  151. package/src/headers/{16 → 22}/stream_wrap.h +2 -1
  152. package/src/headers/{18 → 22}/string_bytes.h +5 -14
  153. package/src/headers/{14 → 22}/string_decoder-inl.h +0 -6
  154. package/src/headers/{16 → 22}/string_decoder.h +0 -1
  155. package/src/headers/{18 → 22}/tcp_wrap.h +1 -1
  156. package/src/headers/{18 → 22}/threadpoolwork-inl.h +14 -1
  157. package/src/headers/22/timers.h +76 -0
  158. package/src/headers/{18 → 22}/tracing/trace_event.h +7 -5
  159. package/src/headers/{16 → 22}/udp_wrap.h +8 -5
  160. package/src/headers/22/undici_version.h +6 -0
  161. package/src/headers/{18 → 22}/util-inl.h +97 -127
  162. package/src/headers/{18 → 22}/util.h +293 -106
  163. package/src/headers/{18 → 22}/v8-fast-api-calls.h +103 -58
  164. package/dist/bindings/cws_darwin_arm64_node83.node +0 -0
  165. package/dist/bindings/cws_darwin_arm64_node93.node +0 -0
  166. package/dist/bindings/cws_darwin_x64_node83.node +0 -0
  167. package/dist/bindings/cws_darwin_x64_node93.node +0 -0
  168. package/dist/bindings/cws_linux_arm64_node83.node +0 -0
  169. package/dist/bindings/cws_linux_arm64_node93.node +0 -0
  170. package/dist/bindings/cws_linux_x64_node83.node +0 -0
  171. package/dist/bindings/cws_linux_x64_node93.node +0 -0
  172. package/src/headers/14/aliased_buffer.h +0 -263
  173. package/src/headers/14/allocated_buffer-inl.h +0 -110
  174. package/src/headers/14/allocated_buffer.h +0 -73
  175. package/src/headers/14/async_wrap-inl.h +0 -94
  176. package/src/headers/14/async_wrap.h +0 -230
  177. package/src/headers/14/base64.h +0 -183
  178. package/src/headers/14/base_object-inl.h +0 -371
  179. package/src/headers/14/base_object.h +0 -281
  180. package/src/headers/14/callback_queue-inl.h +0 -97
  181. package/src/headers/14/callback_queue.h +0 -78
  182. package/src/headers/14/debug_utils-inl.h +0 -223
  183. package/src/headers/14/debug_utils.h +0 -181
  184. package/src/headers/14/env.h +0 -1388
  185. package/src/headers/14/handle_wrap.h +0 -117
  186. package/src/headers/14/histogram-inl.h +0 -83
  187. package/src/headers/14/histogram.h +0 -98
  188. package/src/headers/14/inspector_agent.h +0 -149
  189. package/src/headers/14/inspector_profiler.h +0 -137
  190. package/src/headers/14/js_native_api.h +0 -544
  191. package/src/headers/14/js_native_api_types.h +0 -143
  192. package/src/headers/14/js_native_api_v8.h +0 -301
  193. package/src/headers/14/js_native_api_v8_internals.h +0 -38
  194. package/src/headers/14/json_utils.h +0 -161
  195. package/src/headers/14/memory_tracker-inl.h +0 -355
  196. package/src/headers/14/module_wrap.h +0 -99
  197. package/src/headers/14/node.h +0 -1032
  198. package/src/headers/14/node_api.h +0 -255
  199. package/src/headers/14/node_api_types.h +0 -44
  200. package/src/headers/14/node_binding.h +0 -99
  201. package/src/headers/14/node_buffer.h +0 -92
  202. package/src/headers/14/node_constants.h +0 -84
  203. package/src/headers/14/node_context_data.h +0 -44
  204. package/src/headers/14/node_contextify.h +0 -161
  205. package/src/headers/14/node_crypto.h +0 -865
  206. package/src/headers/14/node_crypto_bio.h +0 -195
  207. package/src/headers/14/node_crypto_clienthello-inl.h +0 -91
  208. package/src/headers/14/node_crypto_clienthello.h +0 -132
  209. package/src/headers/14/node_crypto_common.h +0 -138
  210. package/src/headers/14/node_crypto_groups.h +0 -415
  211. package/src/headers/14/node_dtrace.h +0 -86
  212. package/src/headers/14/node_errors.h +0 -214
  213. package/src/headers/14/node_file-inl.h +0 -306
  214. package/src/headers/14/node_file.h +0 -417
  215. package/src/headers/14/node_http2.h +0 -1191
  216. package/src/headers/14/node_http2_state.h +0 -149
  217. package/src/headers/14/node_http_common-inl.h +0 -194
  218. package/src/headers/14/node_http_common.h +0 -529
  219. package/src/headers/14/node_i18n.h +0 -144
  220. package/src/headers/14/node_internals.h +0 -405
  221. package/src/headers/14/node_main_instance.h +0 -96
  222. package/src/headers/14/node_mem.h +0 -45
  223. package/src/headers/14/node_messaging.h +0 -303
  224. package/src/headers/14/node_metadata.h +0 -109
  225. package/src/headers/14/node_mutex.h +0 -247
  226. package/src/headers/14/node_native_module.h +0 -101
  227. package/src/headers/14/node_native_module_env.h +0 -66
  228. package/src/headers/14/node_options-inl.h +0 -451
  229. package/src/headers/14/node_options.h +0 -481
  230. package/src/headers/14/node_perf.h +0 -181
  231. package/src/headers/14/node_perf_common.h +0 -97
  232. package/src/headers/14/node_platform.h +0 -189
  233. package/src/headers/14/node_process.h +0 -40
  234. package/src/headers/14/node_report.h +0 -47
  235. package/src/headers/14/node_revert.h +0 -72
  236. package/src/headers/14/node_root_certs.h +0 -3458
  237. package/src/headers/14/node_sockaddr-inl.h +0 -170
  238. package/src/headers/14/node_sockaddr.h +0 -123
  239. package/src/headers/14/node_stat_watcher.h +0 -70
  240. package/src/headers/14/node_union_bytes.h +0 -103
  241. package/src/headers/14/node_url.h +0 -188
  242. package/src/headers/14/node_version.h +0 -98
  243. package/src/headers/14/node_wasi.h +0 -108
  244. package/src/headers/14/node_win32_etw_provider-inl.h +0 -287
  245. package/src/headers/14/node_win32_etw_provider.h +0 -99
  246. package/src/headers/14/node_worker.h +0 -141
  247. package/src/headers/14/pipe_wrap.h +0 -78
  248. package/src/headers/14/req_wrap-inl.h +0 -170
  249. package/src/headers/14/req_wrap.h +0 -77
  250. package/src/headers/14/stream_base-inl.h +0 -275
  251. package/src/headers/14/stream_base.h +0 -434
  252. package/src/headers/14/stream_pipe.h +0 -73
  253. package/src/headers/14/stream_wrap.h +0 -130
  254. package/src/headers/14/string_bytes.h +0 -129
  255. package/src/headers/14/string_decoder.h +0 -50
  256. package/src/headers/14/string_search.h +0 -638
  257. package/src/headers/14/tcp_wrap.h +0 -101
  258. package/src/headers/14/threadpoolwork-inl.h +0 -57
  259. package/src/headers/14/tls_wrap.h +0 -222
  260. package/src/headers/14/tracing/agent.h +0 -195
  261. package/src/headers/14/tracing/trace_event.h +0 -720
  262. package/src/headers/14/tty_wrap.h +0 -64
  263. package/src/headers/14/udp_wrap.h +0 -227
  264. package/src/headers/14/util-inl.h +0 -566
  265. package/src/headers/14/util.h +0 -804
  266. package/src/headers/14/v8abbr.h +0 -124
  267. package/src/headers/16/aliased_buffer.h +0 -315
  268. package/src/headers/16/aliased_struct-inl.h +0 -54
  269. package/src/headers/16/aliased_struct.h +0 -63
  270. package/src/headers/16/allocated_buffer-inl.h +0 -110
  271. package/src/headers/16/allocated_buffer.h +0 -73
  272. package/src/headers/16/async_wrap-inl.h +0 -94
  273. package/src/headers/16/async_wrap.h +0 -246
  274. package/src/headers/16/base64-inl.h +0 -189
  275. package/src/headers/16/base64.h +0 -69
  276. package/src/headers/16/base_object.h +0 -294
  277. package/src/headers/16/connect_wrap.h +0 -26
  278. package/src/headers/16/connection_wrap.h +0 -30
  279. package/src/headers/16/crypto/crypto_aes.h +0 -89
  280. package/src/headers/16/crypto/crypto_bio.h +0 -194
  281. package/src/headers/16/crypto/crypto_cipher.h +0 -286
  282. package/src/headers/16/crypto/crypto_clienthello-inl.h +0 -90
  283. package/src/headers/16/crypto/crypto_clienthello.h +0 -131
  284. package/src/headers/16/crypto/crypto_common.h +0 -187
  285. package/src/headers/16/crypto/crypto_context.h +0 -147
  286. package/src/headers/16/crypto/crypto_dh.h +0 -157
  287. package/src/headers/16/crypto/crypto_dsa.h +0 -76
  288. package/src/headers/16/crypto/crypto_ec.h +0 -169
  289. package/src/headers/16/crypto/crypto_groups.h +0 -415
  290. package/src/headers/16/crypto/crypto_hash.h +0 -89
  291. package/src/headers/16/crypto/crypto_hkdf.h +0 -66
  292. package/src/headers/16/crypto/crypto_hmac.h +0 -94
  293. package/src/headers/16/crypto/crypto_keygen.h +0 -301
  294. package/src/headers/16/crypto/crypto_keys.h +0 -412
  295. package/src/headers/16/crypto/crypto_pbkdf2.h +0 -76
  296. package/src/headers/16/crypto/crypto_random.h +0 -130
  297. package/src/headers/16/crypto/crypto_rsa.h +0 -141
  298. package/src/headers/16/crypto/crypto_scrypt.h +0 -87
  299. package/src/headers/16/crypto/crypto_sig.h +0 -167
  300. package/src/headers/16/crypto/crypto_spkac.h +0 -20
  301. package/src/headers/16/crypto/crypto_timing.h +0 -20
  302. package/src/headers/16/crypto/crypto_tls.h +0 -292
  303. package/src/headers/16/crypto/crypto_util.h +0 -736
  304. package/src/headers/16/crypto/crypto_x509.h +0 -141
  305. package/src/headers/16/debug_utils.h +0 -184
  306. package/src/headers/16/diagnosticfilename-inl.h +0 -33
  307. package/src/headers/16/env-inl.h +0 -1277
  308. package/src/headers/16/env.h +0 -1629
  309. package/src/headers/16/handle_wrap.h +0 -121
  310. package/src/headers/16/histogram-inl.h +0 -88
  311. package/src/headers/16/histogram.h +0 -216
  312. package/src/headers/16/inspector_io.h +0 -78
  313. package/src/headers/16/inspector_socket.h +0 -60
  314. package/src/headers/16/inspector_socket_server.h +0 -110
  315. package/src/headers/16/js_native_api.h +0 -561
  316. package/src/headers/16/js_native_api_types.h +0 -160
  317. package/src/headers/16/js_native_api_v8.h +0 -451
  318. package/src/headers/16/js_native_api_v8_internals.h +0 -39
  319. package/src/headers/16/js_stream.h +0 -52
  320. package/src/headers/16/memory_tracker-inl.h +0 -356
  321. package/src/headers/16/memory_tracker.h +0 -284
  322. package/src/headers/16/node.d +0 -315
  323. package/src/headers/16/node.h +0 -1132
  324. package/src/headers/16/node.stp +0 -146
  325. package/src/headers/16/node_api.h +0 -275
  326. package/src/headers/16/node_api_internals.h +0 -30
  327. package/src/headers/16/node_api_types.h +0 -50
  328. package/src/headers/16/node_binding.h +0 -99
  329. package/src/headers/16/node_blob.h +0 -191
  330. package/src/headers/16/node_bob-inl.h +0 -37
  331. package/src/headers/16/node_bob.h +0 -111
  332. package/src/headers/16/node_buffer.h +0 -92
  333. package/src/headers/16/node_constants.h +0 -84
  334. package/src/headers/16/node_context_data.h +0 -44
  335. package/src/headers/16/node_contextify.h +0 -196
  336. package/src/headers/16/node_dir.h +0 -52
  337. package/src/headers/16/node_dtrace.h +0 -86
  338. package/src/headers/16/node_errors.h +0 -277
  339. package/src/headers/16/node_external_reference.h +0 -129
  340. package/src/headers/16/node_file-inl.h +0 -306
  341. package/src/headers/16/node_http2.h +0 -1140
  342. package/src/headers/16/node_http_common-inl.h +0 -200
  343. package/src/headers/16/node_http_common.h +0 -531
  344. package/src/headers/16/node_internals.h +0 -421
  345. package/src/headers/16/node_main_instance.h +0 -103
  346. package/src/headers/16/node_mem-inl.h +0 -112
  347. package/src/headers/16/node_messaging.h +0 -373
  348. package/src/headers/16/node_metadata.h +0 -122
  349. package/src/headers/16/node_native_module.h +0 -101
  350. package/src/headers/16/node_native_module_env.h +0 -68
  351. package/src/headers/16/node_object_wrap.h +0 -132
  352. package/src/headers/16/node_options-inl.h +0 -477
  353. package/src/headers/16/node_options.h +0 -494
  354. package/src/headers/16/node_perf.h +0 -185
  355. package/src/headers/16/node_perf_common.h +0 -89
  356. package/src/headers/16/node_platform.h +0 -192
  357. package/src/headers/16/node_process.h +0 -43
  358. package/src/headers/16/node_provider.d +0 -80
  359. package/src/headers/16/node_snapshotable.h +0 -137
  360. package/src/headers/16/node_sockaddr-inl.h +0 -266
  361. package/src/headers/16/node_sockaddr.h +0 -405
  362. package/src/headers/16/node_union_bytes.h +0 -103
  363. package/src/headers/16/node_url.h +0 -205
  364. package/src/headers/16/node_v8.h +0 -41
  365. package/src/headers/16/node_v8_platform-inl.h +0 -194
  366. package/src/headers/16/node_version.h +0 -98
  367. package/src/headers/16/node_wasi.h +0 -108
  368. package/src/headers/16/node_watchdog.h +0 -152
  369. package/src/headers/16/node_win32_etw_provider-inl.h +0 -288
  370. package/src/headers/16/node_win32_etw_provider.h +0 -99
  371. package/src/headers/16/node_worker.h +0 -145
  372. package/src/headers/16/req_wrap.h +0 -77
  373. package/src/headers/16/spawn_sync.h +0 -242
  374. package/src/headers/16/stream_base-inl.h +0 -303
  375. package/src/headers/16/stream_base.h +0 -454
  376. package/src/headers/16/stream_pipe.h +0 -73
  377. package/src/headers/16/string_bytes.h +0 -122
  378. package/src/headers/16/string_decoder-inl.h +0 -37
  379. package/src/headers/16/string_search.h +0 -638
  380. package/src/headers/16/tcp_wrap.h +0 -103
  381. package/src/headers/16/threadpoolwork-inl.h +0 -57
  382. package/src/headers/16/timer_wrap.h +0 -84
  383. package/src/headers/16/tracing/agent.h +0 -195
  384. package/src/headers/16/tracing/node_trace_buffer.h +0 -83
  385. package/src/headers/16/tracing/node_trace_writer.h +0 -75
  386. package/src/headers/16/tracing/trace_event.h +0 -720
  387. package/src/headers/16/tracing/trace_event_common.h +0 -1109
  388. package/src/headers/16/tracing/traced_value.h +0 -70
  389. package/src/headers/16/tty_wrap.h +0 -66
  390. package/src/headers/16/util-inl.h +0 -575
  391. package/src/headers/16/util.h +0 -824
  392. package/src/headers/16/v8abbr.h +0 -123
  393. package/src/headers/16/v8ustack.d +0 -695
  394. package/src/headers/18/aliased_buffer.h +0 -315
  395. package/src/headers/18/aliased_struct-inl.h +0 -54
  396. package/src/headers/18/aliased_struct.h +0 -63
  397. package/src/headers/18/base64-inl.h +0 -189
  398. package/src/headers/18/base64.h +0 -69
  399. package/src/headers/18/base_object-inl.h +0 -374
  400. package/src/headers/18/callback_queue-inl.h +0 -97
  401. package/src/headers/18/callback_queue.h +0 -78
  402. package/src/headers/18/cares_wrap.h +0 -523
  403. package/src/headers/18/connect_wrap.h +0 -26
  404. package/src/headers/18/connection_wrap.h +0 -30
  405. package/src/headers/18/crypto/crypto_aes.h +0 -89
  406. package/src/headers/18/crypto/crypto_bio.h +0 -194
  407. package/src/headers/18/crypto/crypto_cipher.h +0 -291
  408. package/src/headers/18/crypto/crypto_clienthello-inl.h +0 -90
  409. package/src/headers/18/crypto/crypto_common.h +0 -151
  410. package/src/headers/18/crypto/crypto_dh.h +0 -156
  411. package/src/headers/18/crypto/crypto_dsa.h +0 -77
  412. package/src/headers/18/crypto/crypto_ec.h +0 -170
  413. package/src/headers/18/crypto/crypto_groups.h +0 -415
  414. package/src/headers/18/crypto/crypto_hash.h +0 -89
  415. package/src/headers/18/crypto/crypto_hkdf.h +0 -65
  416. package/src/headers/18/crypto/crypto_hmac.h +0 -94
  417. package/src/headers/18/crypto/crypto_keygen.h +0 -305
  418. package/src/headers/18/crypto/crypto_pbkdf2.h +0 -76
  419. package/src/headers/18/crypto/crypto_random.h +0 -130
  420. package/src/headers/18/crypto/crypto_rsa.h +0 -141
  421. package/src/headers/18/crypto/crypto_scrypt.h +0 -87
  422. package/src/headers/18/crypto/crypto_sig.h +0 -168
  423. package/src/headers/18/crypto/crypto_spkac.h +0 -21
  424. package/src/headers/18/crypto/crypto_timing.h +0 -20
  425. package/src/headers/18/crypto/crypto_x509.h +0 -143
  426. package/src/headers/18/debug_utils-inl.h +0 -223
  427. package/src/headers/18/diagnosticfilename-inl.h +0 -33
  428. package/src/headers/18/env-inl.h +0 -1308
  429. package/src/headers/18/env.h +0 -1667
  430. package/src/headers/18/inspector_agent.h +0 -144
  431. package/src/headers/18/inspector_io.h +0 -78
  432. package/src/headers/18/inspector_profiler.h +0 -149
  433. package/src/headers/18/inspector_socket.h +0 -60
  434. package/src/headers/18/inspector_socket_server.h +0 -110
  435. package/src/headers/18/js_stream.h +0 -52
  436. package/src/headers/18/json_utils.h +0 -161
  437. package/src/headers/18/memory_tracker.h +0 -284
  438. package/src/headers/18/module_wrap.h +0 -116
  439. package/src/headers/18/node_binding.h +0 -99
  440. package/src/headers/18/node_context_data.h +0 -44
  441. package/src/headers/18/node_contextify.h +0 -196
  442. package/src/headers/18/node_crypto.h +0 -57
  443. package/src/headers/18/node_dir.h +0 -52
  444. package/src/headers/18/node_dtrace.h +0 -86
  445. package/src/headers/18/node_external_reference.h +0 -145
  446. package/src/headers/18/node_file.h +0 -426
  447. package/src/headers/18/node_http2_state.h +0 -149
  448. package/src/headers/18/node_i18n.h +0 -145
  449. package/src/headers/18/node_mem-inl.h +0 -112
  450. package/src/headers/18/node_mem.h +0 -45
  451. package/src/headers/18/node_mutex.h +0 -323
  452. package/src/headers/18/node_native_module.h +0 -109
  453. package/src/headers/18/node_native_module_env.h +0 -71
  454. package/src/headers/18/node_object_wrap.h +0 -132
  455. package/src/headers/18/node_process-inl.h +0 -26
  456. package/src/headers/18/node_report.h +0 -47
  457. package/src/headers/18/node_revert.h +0 -82
  458. package/src/headers/18/node_root_certs.h +0 -3246
  459. package/src/headers/18/node_snapshot_builder.h +0 -43
  460. package/src/headers/18/node_snapshotable.h +0 -130
  461. package/src/headers/18/node_stat_watcher.h +0 -72
  462. package/src/headers/18/node_union_bytes.h +0 -103
  463. package/src/headers/18/node_url.h +0 -205
  464. package/src/headers/18/node_v8.h +0 -41
  465. package/src/headers/18/node_v8_platform-inl.h +0 -194
  466. package/src/headers/18/node_wasi.h +0 -108
  467. package/src/headers/18/node_watchdog.h +0 -152
  468. package/src/headers/18/node_win32_etw_provider-inl.h +0 -288
  469. package/src/headers/18/node_win32_etw_provider.h +0 -99
  470. package/src/headers/18/pipe_wrap.h +0 -80
  471. package/src/headers/18/req_wrap-inl.h +0 -170
  472. package/src/headers/18/spawn_sync.h +0 -242
  473. package/src/headers/18/stream_wrap.h +0 -133
  474. package/src/headers/18/string_decoder-inl.h +0 -37
  475. package/src/headers/18/string_decoder.h +0 -50
  476. package/src/headers/18/string_search.h +0 -638
  477. package/src/headers/18/tracing/node_trace_buffer.h +0 -83
  478. package/src/headers/18/tracing/node_trace_writer.h +0 -75
  479. package/src/headers/18/tracing/trace_event_common.h +0 -1109
  480. package/src/headers/18/tracing/traced_value.h +0 -70
  481. package/src/headers/18/udp_wrap.h +0 -227
  482. package/src/headers/18/v8abbr.h +0 -123
  483. /package/src/headers/{14 → 20}/tracing/node_trace_buffer.h +0 -0
  484. /package/src/headers/{14 → 20}/tracing/node_trace_writer.h +0 -0
  485. /package/src/headers/{14 → 20}/tracing/traced_value.h +0 -0
  486. /package/src/headers/{14 → 22}/aliased_struct-inl.h +0 -0
  487. /package/src/headers/{14 → 22}/aliased_struct.h +0 -0
  488. /package/src/headers/{16 → 22}/callback_queue-inl.h +0 -0
  489. /package/src/headers/{14 → 22}/connect_wrap.h +0 -0
  490. /package/src/headers/{14 → 22}/connection_wrap.h +0 -0
  491. /package/src/headers/{14 → 22}/diagnosticfilename-inl.h +0 -0
  492. /package/src/headers/{18 → 22}/histogram-inl.h +0 -0
  493. /package/src/headers/{14 → 22}/inspector_io.h +0 -0
  494. /package/src/headers/{14 → 22}/inspector_socket.h +0 -0
  495. /package/src/headers/{14 → 22}/inspector_socket_server.h +0 -0
  496. /package/src/headers/{14 → 22}/js_stream.h +0 -0
  497. /package/src/headers/{14 → 22}/node_dir.h +0 -0
  498. /package/src/headers/{14 → 22}/node_mem-inl.h +0 -0
  499. /package/src/headers/{16 → 22}/node_mem.h +0 -0
  500. /package/src/headers/{16 → 22}/node_mutex.h +0 -0
  501. /package/src/headers/{14 → 22}/node_object_wrap.h +0 -0
  502. /package/src/headers/{16 → 22}/node_process-inl.h +0 -0
  503. /package/src/headers/{18 → 22}/node_sockaddr-inl.h +0 -0
  504. /package/src/headers/{18 → 22}/node_wasm_web_api.h +0 -0
  505. /package/src/headers/{16 → 22}/pipe_wrap.h +0 -0
  506. /package/src/headers/{18 → 22}/req_wrap.h +0 -0
  507. /package/src/headers/{18 → 22}/timer_wrap-inl.h +0 -0
  508. /package/src/headers/{18 → 22}/timer_wrap.h +0 -0
  509. /package/src/headers/{18 → 22}/tracing/agent.h +0 -0
  510. /package/src/headers/{14 → 22}/tracing/trace_event_common.h +0 -0
  511. /package/src/headers/{18 → 22}/tty_wrap.h +0 -0
@@ -1,1629 +0,0 @@
1
- // Copyright Joyent, Inc. and other Node contributors.
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a
4
- // copy of this software and associated documentation files (the
5
- // "Software"), to deal in the Software without restriction, including
6
- // without limitation the rights to use, copy, modify, merge, publish,
7
- // distribute, sublicense, and/or sell copies of the Software, and to permit
8
- // persons to whom the Software is furnished to do so, subject to the
9
- // following conditions:
10
- //
11
- // The above copyright notice and this permission notice shall be included
12
- // in all copies or substantial portions of the Software.
13
- //
14
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
-
22
- #ifndef SRC_ENV_H_
23
- #define SRC_ENV_H_
24
-
25
- #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
-
27
- #include "aliased_buffer.h"
28
- #if HAVE_INSPECTOR
29
- #include "inspector_agent.h"
30
- #include "inspector_profiler.h"
31
- #endif
32
- #include "callback_queue.h"
33
- #include "debug_utils.h"
34
- #include "handle_wrap.h"
35
- #include "node.h"
36
- #include "node_binding.h"
37
- #include "node_main_instance.h"
38
- #include "node_options.h"
39
- #include "node_perf_common.h"
40
- #include "node_snapshotable.h"
41
- #include "req_wrap.h"
42
- #include "util.h"
43
- #include "uv.h"
44
- #include "v8.h"
45
-
46
- #include <array>
47
- #include <atomic>
48
- #include <cstdint>
49
- #include <functional>
50
- #include <iostream>
51
- #include <list>
52
- #include <unordered_map>
53
- #include <unordered_set>
54
- #include <vector>
55
-
56
- namespace node {
57
-
58
- namespace contextify {
59
- class ContextifyScript;
60
- class CompiledFnEntry;
61
- }
62
-
63
- namespace performance {
64
- class PerformanceState;
65
- }
66
-
67
- namespace tracing {
68
- class AgentWriterHandle;
69
- }
70
-
71
- #if HAVE_INSPECTOR
72
- namespace profiler {
73
- class V8CoverageConnection;
74
- class V8CpuProfilerConnection;
75
- class V8HeapProfilerConnection;
76
- } // namespace profiler
77
-
78
- namespace inspector {
79
- class ParentInspectorHandle;
80
- }
81
- #endif // HAVE_INSPECTOR
82
-
83
- namespace worker {
84
- class Worker;
85
- }
86
-
87
- namespace loader {
88
- class ModuleWrap;
89
-
90
- struct PackageConfig {
91
- enum class Exists { Yes, No };
92
- enum class IsValid { Yes, No };
93
- enum class HasMain { Yes, No };
94
- enum class HasName { Yes, No };
95
- enum PackageType : uint32_t { None = 0, CommonJS, Module };
96
-
97
- const Exists exists;
98
- const IsValid is_valid;
99
- const HasMain has_main;
100
- const std::string main;
101
- const HasName has_name;
102
- const std::string name;
103
- const PackageType type;
104
-
105
- v8::Global<v8::Value> exports;
106
- };
107
- } // namespace loader
108
-
109
- enum class FsStatsOffset {
110
- kDev = 0,
111
- kMode,
112
- kNlink,
113
- kUid,
114
- kGid,
115
- kRdev,
116
- kBlkSize,
117
- kIno,
118
- kSize,
119
- kBlocks,
120
- kATimeSec,
121
- kATimeNsec,
122
- kMTimeSec,
123
- kMTimeNsec,
124
- kCTimeSec,
125
- kCTimeNsec,
126
- kBirthTimeSec,
127
- kBirthTimeNsec,
128
- kFsStatsFieldsNumber
129
- };
130
-
131
- // Stat fields buffers contain twice the number of entries in an uv_stat_t
132
- // because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances.
133
- constexpr size_t kFsStatsBufferLength =
134
- static_cast<size_t>(FsStatsOffset::kFsStatsFieldsNumber) * 2;
135
-
136
- // PER_ISOLATE_* macros: We have a lot of per-isolate properties
137
- // and adding and maintaining their getters and setters by hand would be
138
- // difficult so let's make the preprocessor generate them for us.
139
- //
140
- // In each macro, `V` is expected to be the name of a macro or function which
141
- // accepts the number of arguments provided in each tuple in the macro body,
142
- // typically two. The named function will be invoked against each tuple.
143
- //
144
- // Make sure that any macro V defined for use with the PER_ISOLATE_* macros is
145
- // undefined again after use.
146
-
147
- // Private symbols are per-isolate primitives but Environment proxies them
148
- // for the sake of convenience. Strings should be ASCII-only and have a
149
- // "node:" prefix to avoid name clashes with third-party code.
150
- #define PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V) \
151
- V(alpn_buffer_private_symbol, "node:alpnBuffer") \
152
- V(arrow_message_private_symbol, "node:arrowMessage") \
153
- V(contextify_context_private_symbol, "node:contextify:context") \
154
- V(contextify_global_private_symbol, "node:contextify:global") \
155
- V(decorated_private_symbol, "node:decorated") \
156
- V(napi_type_tag, "node:napi:type_tag") \
157
- V(napi_wrapper, "node:napi:wrapper") \
158
- V(untransferable_object_private_symbol, "node:untransferableObject") \
159
-
160
- // Symbols are per-isolate primitives but Environment proxies them
161
- // for the sake of convenience.
162
- #define PER_ISOLATE_SYMBOL_PROPERTIES(V) \
163
- V(async_id_symbol, "async_id_symbol") \
164
- V(handle_onclose_symbol, "handle_onclose") \
165
- V(no_message_symbol, "no_message_symbol") \
166
- V(messaging_deserialize_symbol, "messaging_deserialize_symbol") \
167
- V(messaging_transfer_symbol, "messaging_transfer_symbol") \
168
- V(messaging_clone_symbol, "messaging_clone_symbol") \
169
- V(messaging_transfer_list_symbol, "messaging_transfer_list_symbol") \
170
- V(oninit_symbol, "oninit") \
171
- V(owner_symbol, "owner_symbol") \
172
- V(onpskexchange_symbol, "onpskexchange") \
173
- V(trigger_async_id_symbol, "trigger_async_id_symbol") \
174
-
175
- // Strings are per-isolate primitives but Environment proxies them
176
- // for the sake of convenience. Strings should be ASCII-only.
177
- #define PER_ISOLATE_STRING_PROPERTIES(V) \
178
- V(ack_string, "ack") \
179
- V(address_string, "address") \
180
- V(aliases_string, "aliases") \
181
- V(args_string, "args") \
182
- V(asn1curve_string, "asn1Curve") \
183
- V(async_ids_stack_string, "async_ids_stack") \
184
- V(bits_string, "bits") \
185
- V(block_list_string, "blockList") \
186
- V(buffer_string, "buffer") \
187
- V(bytes_parsed_string, "bytesParsed") \
188
- V(bytes_read_string, "bytesRead") \
189
- V(bytes_written_string, "bytesWritten") \
190
- V(cached_data_produced_string, "cachedDataProduced") \
191
- V(cached_data_rejected_string, "cachedDataRejected") \
192
- V(cached_data_string, "cachedData") \
193
- V(cache_key_string, "cacheKey") \
194
- V(change_string, "change") \
195
- V(channel_string, "channel") \
196
- V(chunks_sent_since_last_write_string, "chunksSentSinceLastWrite") \
197
- V(clone_unsupported_type_str, "Cannot transfer object of unsupported type.") \
198
- V(code_string, "code") \
199
- V(commonjs_string, "commonjs") \
200
- V(config_string, "config") \
201
- V(constants_string, "constants") \
202
- V(crypto_dh_string, "dh") \
203
- V(crypto_dsa_string, "dsa") \
204
- V(crypto_ec_string, "ec") \
205
- V(crypto_ed25519_string, "ed25519") \
206
- V(crypto_ed448_string, "ed448") \
207
- V(crypto_x25519_string, "x25519") \
208
- V(crypto_x448_string, "x448") \
209
- V(crypto_rsa_string, "rsa") \
210
- V(crypto_rsa_pss_string, "rsa-pss") \
211
- V(cwd_string, "cwd") \
212
- V(data_string, "data") \
213
- V(default_is_true_string, "defaultIsTrue") \
214
- V(deserialize_info_string, "deserializeInfo") \
215
- V(dest_string, "dest") \
216
- V(destroyed_string, "destroyed") \
217
- V(detached_string, "detached") \
218
- V(dh_string, "DH") \
219
- V(divisor_length_string, "divisorLength") \
220
- V(dns_a_string, "A") \
221
- V(dns_aaaa_string, "AAAA") \
222
- V(dns_caa_string, "CAA") \
223
- V(dns_critical_string, "critical") \
224
- V(dns_cname_string, "CNAME") \
225
- V(dns_mx_string, "MX") \
226
- V(dns_naptr_string, "NAPTR") \
227
- V(dns_ns_string, "NS") \
228
- V(dns_ptr_string, "PTR") \
229
- V(dns_soa_string, "SOA") \
230
- V(dns_srv_string, "SRV") \
231
- V(dns_txt_string, "TXT") \
232
- V(done_string, "done") \
233
- V(duration_string, "duration") \
234
- V(ecdh_string, "ECDH") \
235
- V(emit_string, "emit") \
236
- V(emit_warning_string, "emitWarning") \
237
- V(empty_object_string, "{}") \
238
- V(encoding_string, "encoding") \
239
- V(entries_string, "entries") \
240
- V(entry_type_string, "entryType") \
241
- V(env_pairs_string, "envPairs") \
242
- V(env_var_settings_string, "envVarSettings") \
243
- V(errno_string, "errno") \
244
- V(error_string, "error") \
245
- V(exchange_string, "exchange") \
246
- V(exit_code_string, "exitCode") \
247
- V(expire_string, "expire") \
248
- V(exponent_string, "exponent") \
249
- V(exports_string, "exports") \
250
- V(ext_key_usage_string, "ext_key_usage") \
251
- V(external_stream_string, "_externalStream") \
252
- V(family_string, "family") \
253
- V(fatal_exception_string, "_fatalException") \
254
- V(fd_string, "fd") \
255
- V(fields_string, "fields") \
256
- V(file_string, "file") \
257
- V(filename_string, "filename") \
258
- V(fingerprint256_string, "fingerprint256") \
259
- V(fingerprint_string, "fingerprint") \
260
- V(flags_string, "flags") \
261
- V(flowlabel_string, "flowlabel") \
262
- V(fragment_string, "fragment") \
263
- V(frames_received_string, "framesReceived") \
264
- V(frames_sent_string, "framesSent") \
265
- V(function_string, "function") \
266
- V(get_data_clone_error_string, "_getDataCloneError") \
267
- V(get_shared_array_buffer_id_string, "_getSharedArrayBufferId") \
268
- V(gid_string, "gid") \
269
- V(h2_string, "h2") \
270
- V(handle_string, "handle") \
271
- V(hash_algorithm_string, "hashAlgorithm") \
272
- V(help_text_string, "helpText") \
273
- V(homedir_string, "homedir") \
274
- V(host_string, "host") \
275
- V(hostmaster_string, "hostmaster") \
276
- V(http_1_1_string, "http/1.1") \
277
- V(id_string, "id") \
278
- V(identity_string, "identity") \
279
- V(ignore_string, "ignore") \
280
- V(infoaccess_string, "infoAccess") \
281
- V(inherit_string, "inherit") \
282
- V(input_string, "input") \
283
- V(internal_binding_string, "internalBinding") \
284
- V(internal_string, "internal") \
285
- V(ipv4_string, "IPv4") \
286
- V(ipv6_string, "IPv6") \
287
- V(isclosing_string, "isClosing") \
288
- V(issuer_string, "issuer") \
289
- V(issuercert_string, "issuerCertificate") \
290
- V(jwk_crv_string, "crv") \
291
- V(jwk_d_string, "d") \
292
- V(jwk_dp_string, "dp") \
293
- V(jwk_dq_string, "dq") \
294
- V(jwk_dsa_string, "DSA") \
295
- V(jwk_e_string, "e") \
296
- V(jwk_ec_string, "EC") \
297
- V(jwk_g_string, "g") \
298
- V(jwk_k_string, "k") \
299
- V(jwk_p_string, "p") \
300
- V(jwk_q_string, "q") \
301
- V(jwk_qi_string, "qi") \
302
- V(jwk_kty_string, "kty") \
303
- V(jwk_n_string, "n") \
304
- V(jwk_oct_string, "oct") \
305
- V(jwk_okp_string, "OKP") \
306
- V(jwk_rsa_string, "RSA") \
307
- V(jwk_x_string, "x") \
308
- V(jwk_y_string, "y") \
309
- V(kill_signal_string, "killSignal") \
310
- V(kind_string, "kind") \
311
- V(length_string, "length") \
312
- V(library_string, "library") \
313
- V(mac_string, "mac") \
314
- V(max_buffer_string, "maxBuffer") \
315
- V(max_concurrent_streams_string, "maxConcurrentStreams") \
316
- V(message_port_constructor_string, "MessagePort") \
317
- V(message_port_string, "messagePort") \
318
- V(message_string, "message") \
319
- V(messageerror_string, "messageerror") \
320
- V(mgf1_hash_algorithm_string, "mgf1HashAlgorithm") \
321
- V(minttl_string, "minttl") \
322
- V(module_string, "module") \
323
- V(modulus_string, "modulus") \
324
- V(modulus_length_string, "modulusLength") \
325
- V(name_string, "name") \
326
- V(named_curve_string, "namedCurve") \
327
- V(netmask_string, "netmask") \
328
- V(next_string, "next") \
329
- V(nistcurve_string, "nistCurve") \
330
- V(node_string, "node") \
331
- V(nsname_string, "nsname") \
332
- V(ocsp_request_string, "OCSPRequest") \
333
- V(oncertcb_string, "oncertcb") \
334
- V(onchange_string, "onchange") \
335
- V(onclienthello_string, "onclienthello") \
336
- V(oncomplete_string, "oncomplete") \
337
- V(onconnection_string, "onconnection") \
338
- V(ondone_string, "ondone") \
339
- V(onerror_string, "onerror") \
340
- V(onexit_string, "onexit") \
341
- V(onhandshakedone_string, "onhandshakedone") \
342
- V(onhandshakestart_string, "onhandshakestart") \
343
- V(onkeylog_string, "onkeylog") \
344
- V(onmessage_string, "onmessage") \
345
- V(onnewsession_string, "onnewsession") \
346
- V(onocspresponse_string, "onocspresponse") \
347
- V(onreadstart_string, "onreadstart") \
348
- V(onreadstop_string, "onreadstop") \
349
- V(onshutdown_string, "onshutdown") \
350
- V(onsignal_string, "onsignal") \
351
- V(onunpipe_string, "onunpipe") \
352
- V(onwrite_string, "onwrite") \
353
- V(openssl_error_stack, "opensslErrorStack") \
354
- V(options_string, "options") \
355
- V(order_string, "order") \
356
- V(output_string, "output") \
357
- V(overlapped_string, "overlapped") \
358
- V(parse_error_string, "Parse Error") \
359
- V(password_string, "password") \
360
- V(path_string, "path") \
361
- V(pending_handle_string, "pendingHandle") \
362
- V(pid_string, "pid") \
363
- V(ping_rtt_string, "pingRTT") \
364
- V(pipe_source_string, "pipeSource") \
365
- V(pipe_string, "pipe") \
366
- V(pipe_target_string, "pipeTarget") \
367
- V(port1_string, "port1") \
368
- V(port2_string, "port2") \
369
- V(port_string, "port") \
370
- V(preference_string, "preference") \
371
- V(primordials_string, "primordials") \
372
- V(priority_string, "priority") \
373
- V(process_string, "process") \
374
- V(promise_string, "promise") \
375
- V(psk_string, "psk") \
376
- V(pubkey_string, "pubkey") \
377
- V(public_exponent_string, "publicExponent") \
378
- V(query_string, "query") \
379
- V(rate_string, "rate") \
380
- V(raw_string, "raw") \
381
- V(read_host_object_string, "_readHostObject") \
382
- V(readable_string, "readable") \
383
- V(reason_string, "reason") \
384
- V(refresh_string, "refresh") \
385
- V(regexp_string, "regexp") \
386
- V(rename_string, "rename") \
387
- V(replacement_string, "replacement") \
388
- V(require_string, "require") \
389
- V(retry_string, "retry") \
390
- V(salt_length_string, "saltLength") \
391
- V(scheme_string, "scheme") \
392
- V(scopeid_string, "scopeid") \
393
- V(serial_number_string, "serialNumber") \
394
- V(serial_string, "serial") \
395
- V(servername_string, "servername") \
396
- V(service_string, "service") \
397
- V(session_id_string, "sessionId") \
398
- V(shell_string, "shell") \
399
- V(signal_string, "signal") \
400
- V(sink_string, "sink") \
401
- V(size_string, "size") \
402
- V(sni_context_err_string, "Invalid SNI context") \
403
- V(sni_context_string, "sni_context") \
404
- V(source_string, "source") \
405
- V(stack_string, "stack") \
406
- V(standard_name_string, "standardName") \
407
- V(start_time_string, "startTime") \
408
- V(state_string, "state") \
409
- V(stats_string, "stats") \
410
- V(status_string, "status") \
411
- V(stdio_string, "stdio") \
412
- V(stream_average_duration_string, "streamAverageDuration") \
413
- V(stream_count_string, "streamCount") \
414
- V(subject_string, "subject") \
415
- V(subjectaltname_string, "subjectaltname") \
416
- V(syscall_string, "syscall") \
417
- V(target_string, "target") \
418
- V(thread_id_string, "threadId") \
419
- V(ticketkeycallback_string, "onticketkeycallback") \
420
- V(timeout_string, "timeout") \
421
- V(time_to_first_byte_string, "timeToFirstByte") \
422
- V(time_to_first_byte_sent_string, "timeToFirstByteSent") \
423
- V(time_to_first_header_string, "timeToFirstHeader") \
424
- V(tls_ticket_string, "tlsTicket") \
425
- V(transfer_string, "transfer") \
426
- V(ttl_string, "ttl") \
427
- V(type_string, "type") \
428
- V(uid_string, "uid") \
429
- V(unknown_string, "<unknown>") \
430
- V(url_special_ftp_string, "ftp:") \
431
- V(url_special_file_string, "file:") \
432
- V(url_special_http_string, "http:") \
433
- V(url_special_https_string, "https:") \
434
- V(url_special_ws_string, "ws:") \
435
- V(url_special_wss_string, "wss:") \
436
- V(url_string, "url") \
437
- V(username_string, "username") \
438
- V(valid_from_string, "valid_from") \
439
- V(valid_to_string, "valid_to") \
440
- V(value_string, "value") \
441
- V(verify_error_string, "verifyError") \
442
- V(version_string, "version") \
443
- V(weight_string, "weight") \
444
- V(windows_hide_string, "windowsHide") \
445
- V(windows_verbatim_arguments_string, "windowsVerbatimArguments") \
446
- V(wrap_string, "wrap") \
447
- V(writable_string, "writable") \
448
- V(write_host_object_string, "_writeHostObject") \
449
- V(write_queue_size_string, "writeQueueSize") \
450
- V(x_forwarded_string, "x-forwarded-for") \
451
- V(zero_return_string, "ZERO_RETURN")
452
-
453
- #define ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V) \
454
- V(async_wrap_ctor_template, v8::FunctionTemplate) \
455
- V(async_wrap_object_ctor_template, v8::FunctionTemplate) \
456
- V(base_object_ctor_template, v8::FunctionTemplate) \
457
- V(binding_data_ctor_template, v8::FunctionTemplate) \
458
- V(blob_constructor_template, v8::FunctionTemplate) \
459
- V(blocklist_constructor_template, v8::FunctionTemplate) \
460
- V(compiled_fn_entry_template, v8::ObjectTemplate) \
461
- V(dir_instance_template, v8::ObjectTemplate) \
462
- V(fd_constructor_template, v8::ObjectTemplate) \
463
- V(fdclose_constructor_template, v8::ObjectTemplate) \
464
- V(filehandlereadwrap_template, v8::ObjectTemplate) \
465
- V(fsreqpromise_constructor_template, v8::ObjectTemplate) \
466
- V(handle_wrap_ctor_template, v8::FunctionTemplate) \
467
- V(histogram_ctor_template, v8::FunctionTemplate) \
468
- V(http2settings_constructor_template, v8::ObjectTemplate) \
469
- V(http2stream_constructor_template, v8::ObjectTemplate) \
470
- V(http2ping_constructor_template, v8::ObjectTemplate) \
471
- V(i18n_converter_template, v8::ObjectTemplate) \
472
- V(intervalhistogram_constructor_template, v8::FunctionTemplate) \
473
- V(libuv_stream_wrap_ctor_template, v8::FunctionTemplate) \
474
- V(message_port_constructor_template, v8::FunctionTemplate) \
475
- V(microtask_queue_ctor_template, v8::FunctionTemplate) \
476
- V(pipe_constructor_template, v8::FunctionTemplate) \
477
- V(promise_wrap_template, v8::ObjectTemplate) \
478
- V(sab_lifetimepartner_constructor_template, v8::FunctionTemplate) \
479
- V(script_context_constructor_template, v8::FunctionTemplate) \
480
- V(secure_context_constructor_template, v8::FunctionTemplate) \
481
- V(shutdown_wrap_template, v8::ObjectTemplate) \
482
- V(socketaddress_constructor_template, v8::FunctionTemplate) \
483
- V(streambaseoutputstream_constructor_template, v8::ObjectTemplate) \
484
- V(qlogoutputstream_constructor_template, v8::ObjectTemplate) \
485
- V(tcp_constructor_template, v8::FunctionTemplate) \
486
- V(tty_constructor_template, v8::FunctionTemplate) \
487
- V(write_wrap_template, v8::ObjectTemplate) \
488
- V(worker_heap_snapshot_taker_template, v8::ObjectTemplate) \
489
- V(x509_constructor_template, v8::FunctionTemplate)
490
-
491
- #define ENVIRONMENT_STRONG_PERSISTENT_VALUES(V) \
492
- V(async_hooks_after_function, v8::Function) \
493
- V(async_hooks_before_function, v8::Function) \
494
- V(async_hooks_callback_trampoline, v8::Function) \
495
- V(async_hooks_binding, v8::Object) \
496
- V(async_hooks_destroy_function, v8::Function) \
497
- V(async_hooks_init_function, v8::Function) \
498
- V(async_hooks_promise_resolve_function, v8::Function) \
499
- V(buffer_prototype_object, v8::Object) \
500
- V(crypto_key_object_constructor, v8::Function) \
501
- V(crypto_key_object_handle_constructor, v8::Function) \
502
- V(crypto_key_object_private_constructor, v8::Function) \
503
- V(crypto_key_object_public_constructor, v8::Function) \
504
- V(crypto_key_object_secret_constructor, v8::Function) \
505
- V(domexception_function, v8::Function) \
506
- V(enhance_fatal_stack_after_inspector, v8::Function) \
507
- V(enhance_fatal_stack_before_inspector, v8::Function) \
508
- V(fs_use_promises_symbol, v8::Symbol) \
509
- V(host_import_module_dynamically_callback, v8::Function) \
510
- V(host_initialize_import_meta_object_callback, v8::Function) \
511
- V(http2session_on_altsvc_function, v8::Function) \
512
- V(http2session_on_error_function, v8::Function) \
513
- V(http2session_on_frame_error_function, v8::Function) \
514
- V(http2session_on_goaway_data_function, v8::Function) \
515
- V(http2session_on_headers_function, v8::Function) \
516
- V(http2session_on_origin_function, v8::Function) \
517
- V(http2session_on_ping_function, v8::Function) \
518
- V(http2session_on_priority_function, v8::Function) \
519
- V(http2session_on_settings_function, v8::Function) \
520
- V(http2session_on_stream_close_function, v8::Function) \
521
- V(http2session_on_stream_trailers_function, v8::Function) \
522
- V(internal_binding_loader, v8::Function) \
523
- V(immediate_callback_function, v8::Function) \
524
- V(inspector_console_extension_installer, v8::Function) \
525
- V(inspector_disable_async_hooks, v8::Function) \
526
- V(inspector_enable_async_hooks, v8::Function) \
527
- V(messaging_deserialize_create_object, v8::Function) \
528
- V(message_port, v8::Object) \
529
- V(native_module_require, v8::Function) \
530
- V(performance_entry_callback, v8::Function) \
531
- V(performance_entry_template, v8::Function) \
532
- V(prepare_stack_trace_callback, v8::Function) \
533
- V(process_object, v8::Object) \
534
- V(primordials, v8::Object) \
535
- V(primordials_safe_map_prototype_object, v8::Object) \
536
- V(primordials_safe_set_prototype_object, v8::Object) \
537
- V(primordials_safe_weak_map_prototype_object, v8::Object) \
538
- V(primordials_safe_weak_set_prototype_object, v8::Object) \
539
- V(promise_hook_handler, v8::Function) \
540
- V(promise_reject_callback, v8::Function) \
541
- V(script_data_constructor_function, v8::Function) \
542
- V(source_map_cache_getter, v8::Function) \
543
- V(tick_callback_function, v8::Function) \
544
- V(timers_callback_function, v8::Function) \
545
- V(tls_wrap_constructor_function, v8::Function) \
546
- V(trace_category_state_function, v8::Function) \
547
- V(udp_constructor_function, v8::Function) \
548
- V(url_constructor_function, v8::Function)
549
-
550
- class Environment;
551
- struct AllocatedBuffer;
552
-
553
- typedef size_t SnapshotIndex;
554
- class IsolateData : public MemoryRetainer {
555
- public:
556
- IsolateData(v8::Isolate* isolate,
557
- uv_loop_t* event_loop,
558
- MultiIsolatePlatform* platform = nullptr,
559
- ArrayBufferAllocator* node_allocator = nullptr,
560
- const std::vector<size_t>* indexes = nullptr);
561
- SET_MEMORY_INFO_NAME(IsolateData)
562
- SET_SELF_SIZE(IsolateData)
563
- void MemoryInfo(MemoryTracker* tracker) const override;
564
- std::vector<size_t> Serialize(v8::SnapshotCreator* creator);
565
-
566
- inline uv_loop_t* event_loop() const;
567
- inline MultiIsolatePlatform* platform() const;
568
- inline std::shared_ptr<PerIsolateOptions> options();
569
- inline void set_options(std::shared_ptr<PerIsolateOptions> options);
570
-
571
- inline NodeArrayBufferAllocator* node_allocator() const;
572
-
573
- inline worker::Worker* worker_context() const;
574
- inline void set_worker_context(worker::Worker* context);
575
-
576
- #define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
577
- #define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
578
- #define VS(PropertyName, StringValue) V(v8::String, PropertyName)
579
- #define V(TypeName, PropertyName) \
580
- inline v8::Local<TypeName> PropertyName() const;
581
- PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
582
- PER_ISOLATE_SYMBOL_PROPERTIES(VY)
583
- PER_ISOLATE_STRING_PROPERTIES(VS)
584
- #undef V
585
- #undef VY
586
- #undef VS
587
- #undef VP
588
- inline v8::Local<v8::String> async_wrap_provider(int index) const;
589
-
590
- size_t max_young_gen_size = 1;
591
- std::unordered_map<const char*, v8::Eternal<v8::String>> static_str_map;
592
-
593
- inline v8::Isolate* isolate() const;
594
- IsolateData(const IsolateData&) = delete;
595
- IsolateData& operator=(const IsolateData&) = delete;
596
- IsolateData(IsolateData&&) = delete;
597
- IsolateData& operator=(IsolateData&&) = delete;
598
-
599
- private:
600
- void DeserializeProperties(const std::vector<size_t>* indexes);
601
- void CreateProperties();
602
-
603
- #define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
604
- #define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
605
- #define VS(PropertyName, StringValue) V(v8::String, PropertyName)
606
- #define V(TypeName, PropertyName) \
607
- v8::Eternal<TypeName> PropertyName ## _;
608
- PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
609
- PER_ISOLATE_SYMBOL_PROPERTIES(VY)
610
- PER_ISOLATE_STRING_PROPERTIES(VS)
611
- #undef V
612
- #undef VY
613
- #undef VS
614
- #undef VP
615
- // Keep a list of all Persistent strings used for AsyncWrap Provider types.
616
- std::array<v8::Eternal<v8::String>, AsyncWrap::PROVIDERS_LENGTH>
617
- async_wrap_providers_;
618
-
619
- v8::Isolate* const isolate_;
620
- uv_loop_t* const event_loop_;
621
- NodeArrayBufferAllocator* const node_allocator_;
622
- MultiIsolatePlatform* platform_;
623
- std::shared_ptr<PerIsolateOptions> options_;
624
- worker::Worker* worker_context_ = nullptr;
625
- };
626
-
627
- struct ContextInfo {
628
- explicit ContextInfo(const std::string& name) : name(name) {}
629
- const std::string name;
630
- std::string origin;
631
- bool is_default = false;
632
- };
633
-
634
- class EnabledDebugList;
635
-
636
- class KVStore {
637
- public:
638
- KVStore() = default;
639
- virtual ~KVStore() = default;
640
- KVStore(const KVStore&) = delete;
641
- KVStore& operator=(const KVStore&) = delete;
642
- KVStore(KVStore&&) = delete;
643
- KVStore& operator=(KVStore&&) = delete;
644
-
645
- virtual v8::MaybeLocal<v8::String> Get(v8::Isolate* isolate,
646
- v8::Local<v8::String> key) const = 0;
647
- virtual v8::Maybe<std::string> Get(const char* key) const = 0;
648
- virtual void Set(v8::Isolate* isolate,
649
- v8::Local<v8::String> key,
650
- v8::Local<v8::String> value) = 0;
651
- virtual int32_t Query(v8::Isolate* isolate,
652
- v8::Local<v8::String> key) const = 0;
653
- virtual int32_t Query(const char* key) const = 0;
654
- virtual void Delete(v8::Isolate* isolate, v8::Local<v8::String> key) = 0;
655
- virtual v8::Local<v8::Array> Enumerate(v8::Isolate* isolate) const = 0;
656
-
657
- virtual std::shared_ptr<KVStore> Clone(v8::Isolate* isolate) const;
658
- virtual v8::Maybe<bool> AssignFromObject(v8::Local<v8::Context> context,
659
- v8::Local<v8::Object> entries);
660
-
661
- static std::shared_ptr<KVStore> CreateMapKVStore();
662
- };
663
-
664
- namespace per_process {
665
- extern std::shared_ptr<KVStore> system_environment;
666
- }
667
-
668
- struct EnvSerializeInfo;
669
-
670
- class AsyncHooks : public MemoryRetainer {
671
- public:
672
- SET_MEMORY_INFO_NAME(AsyncHooks)
673
- SET_SELF_SIZE(AsyncHooks)
674
- void MemoryInfo(MemoryTracker* tracker) const override;
675
-
676
- // Reason for both UidFields and Fields are that one is stored as a double*
677
- // and the other as a uint32_t*.
678
- enum Fields {
679
- kInit,
680
- kBefore,
681
- kAfter,
682
- kDestroy,
683
- kPromiseResolve,
684
- kTotals,
685
- kCheck,
686
- kStackLength,
687
- kUsesExecutionAsyncResource,
688
- kFieldsCount,
689
- };
690
-
691
- enum UidFields {
692
- kExecutionAsyncId,
693
- kTriggerAsyncId,
694
- kAsyncIdCounter,
695
- kDefaultTriggerAsyncId,
696
- kUidFieldsCount,
697
- };
698
-
699
- inline AliasedUint32Array& fields();
700
- inline AliasedFloat64Array& async_id_fields();
701
- inline AliasedFloat64Array& async_ids_stack();
702
- inline v8::Local<v8::Array> js_execution_async_resources();
703
- // Returns the native executionAsyncResource value at stack index `index`.
704
- // Resources provided on the JS side are not stored on the native stack,
705
- // in which case an empty `Local<>` is returned.
706
- // The `js_execution_async_resources` array contains the value in that case.
707
- inline v8::Local<v8::Object> native_execution_async_resource(size_t index);
708
-
709
- inline void SetJSPromiseHooks(v8::Local<v8::Function> init,
710
- v8::Local<v8::Function> before,
711
- v8::Local<v8::Function> after,
712
- v8::Local<v8::Function> resolve);
713
-
714
- inline v8::Local<v8::String> provider_string(int idx);
715
-
716
- inline void no_force_checks();
717
- inline Environment* env();
718
-
719
- inline void push_async_context(double async_id, double trigger_async_id,
720
- v8::Local<v8::Object> execution_async_resource_);
721
- inline bool pop_async_context(double async_id);
722
- inline void clear_async_id_stack(); // Used in fatal exceptions.
723
-
724
- inline void AddContext(v8::Local<v8::Context> ctx);
725
- inline void RemoveContext(v8::Local<v8::Context> ctx);
726
-
727
- AsyncHooks(const AsyncHooks&) = delete;
728
- AsyncHooks& operator=(const AsyncHooks&) = delete;
729
- AsyncHooks(AsyncHooks&&) = delete;
730
- AsyncHooks& operator=(AsyncHooks&&) = delete;
731
- ~AsyncHooks() = default;
732
-
733
- // Used to set the kDefaultTriggerAsyncId in a scope. This is instead of
734
- // passing the trigger_async_id along with other constructor arguments.
735
- class DefaultTriggerAsyncIdScope {
736
- public:
737
- DefaultTriggerAsyncIdScope() = delete;
738
- explicit DefaultTriggerAsyncIdScope(Environment* env,
739
- double init_trigger_async_id);
740
- explicit DefaultTriggerAsyncIdScope(AsyncWrap* async_wrap);
741
- ~DefaultTriggerAsyncIdScope();
742
-
743
- DefaultTriggerAsyncIdScope(const DefaultTriggerAsyncIdScope&) = delete;
744
- DefaultTriggerAsyncIdScope& operator=(const DefaultTriggerAsyncIdScope&) =
745
- delete;
746
- DefaultTriggerAsyncIdScope(DefaultTriggerAsyncIdScope&&) = delete;
747
- DefaultTriggerAsyncIdScope& operator=(DefaultTriggerAsyncIdScope&&) =
748
- delete;
749
-
750
- private:
751
- AsyncHooks* async_hooks_;
752
- double old_default_trigger_async_id_;
753
- };
754
-
755
- struct SerializeInfo {
756
- AliasedBufferIndex async_ids_stack;
757
- AliasedBufferIndex fields;
758
- AliasedBufferIndex async_id_fields;
759
- SnapshotIndex js_execution_async_resources;
760
- std::vector<SnapshotIndex> native_execution_async_resources;
761
- };
762
-
763
- SerializeInfo Serialize(v8::Local<v8::Context> context,
764
- v8::SnapshotCreator* creator);
765
- void Deserialize(v8::Local<v8::Context> context);
766
-
767
- private:
768
- friend class Environment; // So we can call the constructor.
769
- explicit AsyncHooks(v8::Isolate* isolate, const SerializeInfo* info);
770
-
771
- // Stores the ids of the current execution context stack.
772
- AliasedFloat64Array async_ids_stack_;
773
- // Attached to a Uint32Array that tracks the number of active hooks for
774
- // each type.
775
- AliasedUint32Array fields_;
776
- // Attached to a Float64Array that tracks the state of async resources.
777
- AliasedFloat64Array async_id_fields_;
778
-
779
- void grow_async_ids_stack();
780
-
781
- v8::Global<v8::Array> js_execution_async_resources_;
782
- std::vector<v8::Global<v8::Object>> native_execution_async_resources_;
783
-
784
- // Non-empty during deserialization
785
- const SerializeInfo* info_ = nullptr;
786
-
787
- std::vector<v8::Global<v8::Context>> contexts_;
788
-
789
- std::array<v8::Global<v8::Function>, 4> js_promise_hooks_;
790
- };
791
-
792
- class ImmediateInfo : public MemoryRetainer {
793
- public:
794
- inline AliasedUint32Array& fields();
795
- inline uint32_t count() const;
796
- inline uint32_t ref_count() const;
797
- inline bool has_outstanding() const;
798
- inline void ref_count_inc(uint32_t increment);
799
- inline void ref_count_dec(uint32_t decrement);
800
-
801
- ImmediateInfo(const ImmediateInfo&) = delete;
802
- ImmediateInfo& operator=(const ImmediateInfo&) = delete;
803
- ImmediateInfo(ImmediateInfo&&) = delete;
804
- ImmediateInfo& operator=(ImmediateInfo&&) = delete;
805
- ~ImmediateInfo() = default;
806
-
807
- SET_MEMORY_INFO_NAME(ImmediateInfo)
808
- SET_SELF_SIZE(ImmediateInfo)
809
- void MemoryInfo(MemoryTracker* tracker) const override;
810
-
811
- struct SerializeInfo {
812
- AliasedBufferIndex fields;
813
- };
814
- SerializeInfo Serialize(v8::Local<v8::Context> context,
815
- v8::SnapshotCreator* creator);
816
- void Deserialize(v8::Local<v8::Context> context);
817
-
818
- private:
819
- friend class Environment; // So we can call the constructor.
820
- explicit ImmediateInfo(v8::Isolate* isolate, const SerializeInfo* info);
821
-
822
- enum Fields { kCount, kRefCount, kHasOutstanding, kFieldsCount };
823
-
824
- AliasedUint32Array fields_;
825
- };
826
-
827
- class TickInfo : public MemoryRetainer {
828
- public:
829
- inline AliasedUint8Array& fields();
830
- inline bool has_tick_scheduled() const;
831
- inline bool has_rejection_to_warn() const;
832
-
833
- SET_MEMORY_INFO_NAME(TickInfo)
834
- SET_SELF_SIZE(TickInfo)
835
- void MemoryInfo(MemoryTracker* tracker) const override;
836
-
837
- TickInfo(const TickInfo&) = delete;
838
- TickInfo& operator=(const TickInfo&) = delete;
839
- TickInfo(TickInfo&&) = delete;
840
- TickInfo& operator=(TickInfo&&) = delete;
841
- ~TickInfo() = default;
842
-
843
- struct SerializeInfo {
844
- AliasedBufferIndex fields;
845
- };
846
- SerializeInfo Serialize(v8::Local<v8::Context> context,
847
- v8::SnapshotCreator* creator);
848
- void Deserialize(v8::Local<v8::Context> context);
849
-
850
- private:
851
- friend class Environment; // So we can call the constructor.
852
- explicit TickInfo(v8::Isolate* isolate, const SerializeInfo* info);
853
-
854
- enum Fields { kHasTickScheduled = 0, kHasRejectionToWarn, kFieldsCount };
855
-
856
- AliasedUint8Array fields_;
857
- };
858
-
859
- class TrackingTraceStateObserver :
860
- public v8::TracingController::TraceStateObserver {
861
- public:
862
- explicit TrackingTraceStateObserver(Environment* env) : env_(env) {}
863
-
864
- void OnTraceEnabled() override {
865
- UpdateTraceCategoryState();
866
- }
867
-
868
- void OnTraceDisabled() override {
869
- UpdateTraceCategoryState();
870
- }
871
-
872
- private:
873
- void UpdateTraceCategoryState();
874
-
875
- Environment* env_;
876
- };
877
-
878
- class ShouldNotAbortOnUncaughtScope {
879
- public:
880
- explicit inline ShouldNotAbortOnUncaughtScope(Environment* env);
881
- inline void Close();
882
- inline ~ShouldNotAbortOnUncaughtScope();
883
- ShouldNotAbortOnUncaughtScope(const ShouldNotAbortOnUncaughtScope&) = delete;
884
- ShouldNotAbortOnUncaughtScope& operator=(
885
- const ShouldNotAbortOnUncaughtScope&) = delete;
886
- ShouldNotAbortOnUncaughtScope(ShouldNotAbortOnUncaughtScope&&) = delete;
887
- ShouldNotAbortOnUncaughtScope& operator=(ShouldNotAbortOnUncaughtScope&&) =
888
- delete;
889
-
890
- private:
891
- Environment* env_;
892
- };
893
-
894
- class CleanupHookCallback {
895
- public:
896
- typedef void (*Callback)(void*);
897
-
898
- CleanupHookCallback(Callback fn,
899
- void* arg,
900
- uint64_t insertion_order_counter)
901
- : fn_(fn), arg_(arg), insertion_order_counter_(insertion_order_counter) {}
902
-
903
- // Only hashes `arg_`, since that is usually enough to identify the hook.
904
- struct Hash {
905
- inline size_t operator()(const CleanupHookCallback& cb) const;
906
- };
907
-
908
- // Compares by `fn_` and `arg_` being equal.
909
- struct Equal {
910
- inline bool operator()(const CleanupHookCallback& a,
911
- const CleanupHookCallback& b) const;
912
- };
913
-
914
- inline BaseObject* GetBaseObject() const;
915
-
916
- private:
917
- friend class Environment;
918
- Callback fn_;
919
- void* arg_;
920
-
921
- // We keep track of the insertion order for these objects, so that we can
922
- // call the callbacks in reverse order when we are cleaning up.
923
- uint64_t insertion_order_counter_;
924
- };
925
-
926
- struct PropInfo {
927
- std::string name; // name for debugging
928
- size_t id; // In the list - in case there are any empty entries
929
- SnapshotIndex index; // In the snapshot
930
- };
931
-
932
- typedef void (*DeserializeRequestCallback)(v8::Local<v8::Context> context,
933
- v8::Local<v8::Object> holder,
934
- int index,
935
- InternalFieldInfo* info);
936
- struct DeserializeRequest {
937
- DeserializeRequestCallback cb;
938
- v8::Global<v8::Object> holder;
939
- int index;
940
- InternalFieldInfo* info = nullptr; // Owned by the request
941
-
942
- // Move constructor
943
- DeserializeRequest(DeserializeRequest&& other) = default;
944
- };
945
-
946
- struct EnvSerializeInfo {
947
- std::vector<PropInfo> bindings;
948
- std::vector<std::string> native_modules;
949
- AsyncHooks::SerializeInfo async_hooks;
950
- TickInfo::SerializeInfo tick_info;
951
- ImmediateInfo::SerializeInfo immediate_info;
952
- performance::PerformanceState::SerializeInfo performance_state;
953
- AliasedBufferIndex stream_base_state;
954
- AliasedBufferIndex should_abort_on_uncaught_toggle;
955
-
956
- std::vector<PropInfo> persistent_templates;
957
- std::vector<PropInfo> persistent_values;
958
-
959
- SnapshotIndex context;
960
- friend std::ostream& operator<<(std::ostream& o, const EnvSerializeInfo& i);
961
- };
962
-
963
- struct SnapshotData {
964
- SnapshotData() { blob.data = nullptr; }
965
- v8::StartupData blob;
966
- std::vector<size_t> isolate_data_indices;
967
- EnvSerializeInfo env_info;
968
- };
969
-
970
- class Environment : public MemoryRetainer {
971
- public:
972
- Environment(const Environment&) = delete;
973
- Environment& operator=(const Environment&) = delete;
974
- Environment(Environment&&) = delete;
975
- Environment& operator=(Environment&&) = delete;
976
-
977
- SET_MEMORY_INFO_NAME(Environment)
978
-
979
- inline size_t SelfSize() const override;
980
- bool IsRootNode() const override { return true; }
981
- void MemoryInfo(MemoryTracker* tracker) const override;
982
-
983
- EnvSerializeInfo Serialize(v8::SnapshotCreator* creator);
984
- void CreateProperties();
985
- void DeserializeProperties(const EnvSerializeInfo* info);
986
-
987
- void PrintInfoForSnapshotIfDebug();
988
- void PrintAllBaseObjects();
989
- void VerifyNoStrongBaseObjects();
990
- void EnqueueDeserializeRequest(DeserializeRequestCallback cb,
991
- v8::Local<v8::Object> holder,
992
- int index,
993
- InternalFieldInfo* info);
994
- void RunDeserializeRequests();
995
- // Should be called before InitializeInspector()
996
- void InitializeDiagnostics();
997
-
998
- std::string GetCwd();
999
-
1000
- #if HAVE_INSPECTOR
1001
- // If the environment is created for a worker, pass parent_handle and
1002
- // the ownership if transferred into the Environment.
1003
- int InitializeInspector(
1004
- std::unique_ptr<inspector::ParentInspectorHandle> parent_handle);
1005
- #endif
1006
-
1007
- v8::MaybeLocal<v8::Value> BootstrapInternalLoaders();
1008
- v8::MaybeLocal<v8::Value> BootstrapNode();
1009
- v8::MaybeLocal<v8::Value> RunBootstrapping();
1010
-
1011
- inline size_t async_callback_scope_depth() const;
1012
- inline void PushAsyncCallbackScope();
1013
- inline void PopAsyncCallbackScope();
1014
-
1015
- static inline Environment* GetCurrent(v8::Isolate* isolate);
1016
- static inline Environment* GetCurrent(v8::Local<v8::Context> context);
1017
- static inline Environment* GetCurrent(
1018
- const v8::FunctionCallbackInfo<v8::Value>& info);
1019
-
1020
- template <typename T>
1021
- static inline Environment* GetCurrent(
1022
- const v8::PropertyCallbackInfo<T>& info);
1023
-
1024
- // Methods created using SetMethod(), SetPrototypeMethod(), etc. inside
1025
- // this scope can access the created T* object using
1026
- // GetBindingData<T>(args) later.
1027
- template <typename T>
1028
- T* AddBindingData(v8::Local<v8::Context> context,
1029
- v8::Local<v8::Object> target);
1030
- template <typename T, typename U>
1031
- static inline T* GetBindingData(const v8::PropertyCallbackInfo<U>& info);
1032
- template <typename T>
1033
- static inline T* GetBindingData(
1034
- const v8::FunctionCallbackInfo<v8::Value>& info);
1035
- template <typename T>
1036
- static inline T* GetBindingData(v8::Local<v8::Context> context);
1037
-
1038
- typedef std::unordered_map<
1039
- FastStringKey,
1040
- BaseObjectPtr<BaseObject>,
1041
- FastStringKey::Hash> BindingDataStore;
1042
-
1043
- // Create an Environment without initializing a main Context. Use
1044
- // InitializeMainContext() to initialize a main context for it.
1045
- Environment(IsolateData* isolate_data,
1046
- v8::Isolate* isolate,
1047
- const std::vector<std::string>& args,
1048
- const std::vector<std::string>& exec_args,
1049
- const EnvSerializeInfo* env_info,
1050
- EnvironmentFlags::Flags flags,
1051
- ThreadId thread_id);
1052
- void InitializeMainContext(v8::Local<v8::Context> context,
1053
- const EnvSerializeInfo* env_info);
1054
- // Create an Environment and initialize the provided main context for it.
1055
- Environment(IsolateData* isolate_data,
1056
- v8::Local<v8::Context> context,
1057
- const std::vector<std::string>& args,
1058
- const std::vector<std::string>& exec_args,
1059
- const EnvSerializeInfo* env_info,
1060
- EnvironmentFlags::Flags flags,
1061
- ThreadId thread_id);
1062
- ~Environment() override;
1063
-
1064
- void InitializeLibuv();
1065
- inline const std::vector<std::string>& exec_argv();
1066
- inline const std::vector<std::string>& argv();
1067
- const std::string& exec_path() const;
1068
-
1069
- typedef void (*HandleCleanupCb)(Environment* env,
1070
- uv_handle_t* handle,
1071
- void* arg);
1072
- struct HandleCleanup {
1073
- uv_handle_t* handle_;
1074
- HandleCleanupCb cb_;
1075
- void* arg_;
1076
- };
1077
-
1078
- void RegisterHandleCleanups();
1079
- void CleanupHandles();
1080
- void Exit(int code);
1081
- void ExitEnv();
1082
-
1083
- // Register clean-up cb to be called on environment destruction.
1084
- inline void RegisterHandleCleanup(uv_handle_t* handle,
1085
- HandleCleanupCb cb,
1086
- void* arg);
1087
-
1088
- template <typename T, typename OnCloseCallback>
1089
- inline void CloseHandle(T* handle, OnCloseCallback callback);
1090
-
1091
- inline void AssignToContext(v8::Local<v8::Context> context,
1092
- const ContextInfo& info);
1093
-
1094
- void StartProfilerIdleNotifier();
1095
-
1096
- inline v8::Isolate* isolate() const;
1097
- inline uv_loop_t* event_loop() const;
1098
- inline void TryLoadAddon(
1099
- const char* filename,
1100
- int flags,
1101
- const std::function<bool(binding::DLib*)>& was_loaded);
1102
-
1103
- static inline Environment* from_timer_handle(uv_timer_t* handle);
1104
- inline uv_timer_t* timer_handle();
1105
-
1106
- static inline Environment* from_immediate_check_handle(uv_check_t* handle);
1107
- inline uv_check_t* immediate_check_handle();
1108
- inline uv_idle_t* immediate_idle_handle();
1109
-
1110
- inline void IncreaseWaitingRequestCounter();
1111
- inline void DecreaseWaitingRequestCounter();
1112
-
1113
- inline AsyncHooks* async_hooks();
1114
- inline ImmediateInfo* immediate_info();
1115
- inline TickInfo* tick_info();
1116
- inline uint64_t timer_base() const;
1117
- inline std::shared_ptr<KVStore> env_vars();
1118
- inline void set_env_vars(std::shared_ptr<KVStore> env_vars);
1119
-
1120
- inline IsolateData* isolate_data() const;
1121
-
1122
- inline bool printed_error() const;
1123
- inline void set_printed_error(bool value);
1124
-
1125
- void PrintSyncTrace() const;
1126
- inline void set_trace_sync_io(bool value);
1127
-
1128
- inline void set_force_context_aware(bool value);
1129
- inline bool force_context_aware() const;
1130
-
1131
- // This stores whether the --abort-on-uncaught-exception flag was passed
1132
- // to Node.
1133
- inline bool abort_on_uncaught_exception() const;
1134
- inline void set_abort_on_uncaught_exception(bool value);
1135
- // This is a pseudo-boolean that keeps track of whether an uncaught exception
1136
- // should abort the process or not if --abort-on-uncaught-exception was
1137
- // passed to Node. If the flag was not passed, it is ignored.
1138
- inline AliasedUint32Array& should_abort_on_uncaught_toggle();
1139
-
1140
- inline AliasedInt32Array& stream_base_state();
1141
-
1142
- // The necessary API for async_hooks.
1143
- inline double new_async_id();
1144
- inline double execution_async_id();
1145
- inline double trigger_async_id();
1146
- inline double get_default_trigger_async_id();
1147
-
1148
- // List of id's that have been destroyed and need the destroy() cb called.
1149
- inline std::vector<double>* destroy_async_id_list();
1150
-
1151
- std::set<struct node_module*> internal_bindings;
1152
- std::set<std::string> native_modules_with_cache;
1153
- std::set<std::string> native_modules_without_cache;
1154
- // This is only filled during deserialization. We use a vector since
1155
- // it's only used for tests.
1156
- std::vector<std::string> native_modules_in_snapshot;
1157
-
1158
- std::unordered_multimap<int, loader::ModuleWrap*> hash_to_module_map;
1159
- std::unordered_map<uint32_t, loader::ModuleWrap*> id_to_module_map;
1160
- std::unordered_map<uint32_t, contextify::ContextifyScript*>
1161
- id_to_script_map;
1162
- std::unordered_map<uint32_t, contextify::CompiledFnEntry*> id_to_function_map;
1163
-
1164
- inline uint32_t get_next_module_id();
1165
- inline uint32_t get_next_script_id();
1166
- inline uint32_t get_next_function_id();
1167
-
1168
- EnabledDebugList* enabled_debug_list() { return &enabled_debug_list_; }
1169
-
1170
- inline performance::PerformanceState* performance_state();
1171
-
1172
- void CollectUVExceptionInfo(v8::Local<v8::Value> context,
1173
- int errorno,
1174
- const char* syscall = nullptr,
1175
- const char* message = nullptr,
1176
- const char* path = nullptr,
1177
- const char* dest = nullptr);
1178
-
1179
- // If this flag is set, calls into JS (if they would be observable
1180
- // from userland) must be avoided. This flag does not indicate whether
1181
- // calling into JS is allowed from a VM perspective at this point.
1182
- inline bool can_call_into_js() const;
1183
- inline void set_can_call_into_js(bool can_call_into_js);
1184
-
1185
- // Increase or decrease a counter that manages whether this Environment
1186
- // keeps the event loop alive on its own or not. The counter starts out at 0,
1187
- // meaning it does not, and any positive value will make it keep the event
1188
- // loop alive.
1189
- // This is used by Workers to manage their own .ref()/.unref() implementation,
1190
- // as Workers aren't directly associated with their own libuv handles.
1191
- inline void add_refs(int64_t diff);
1192
-
1193
- inline bool has_run_bootstrapping_code() const;
1194
- inline void DoneBootstrapping();
1195
-
1196
- inline bool has_serialized_options() const;
1197
- inline void set_has_serialized_options(bool has_serialized_options);
1198
-
1199
- inline bool is_main_thread() const;
1200
- inline bool no_native_addons() const;
1201
- inline bool should_not_register_esm_loader() const;
1202
- inline bool owns_process_state() const;
1203
- inline bool owns_inspector() const;
1204
- inline bool tracks_unmanaged_fds() const;
1205
- inline bool hide_console_windows() const;
1206
- inline bool no_global_search_paths() const;
1207
- inline uint64_t thread_id() const;
1208
- inline worker::Worker* worker_context() const;
1209
- Environment* worker_parent_env() const;
1210
- inline void add_sub_worker_context(worker::Worker* context);
1211
- inline void remove_sub_worker_context(worker::Worker* context);
1212
- void stop_sub_worker_contexts();
1213
- template <typename Fn>
1214
- inline void ForEachWorker(Fn&& iterator);
1215
- inline bool is_stopping() const;
1216
- inline void set_stopping(bool value);
1217
- inline std::list<node_module>* extra_linked_bindings();
1218
- inline node_module* extra_linked_bindings_head();
1219
- inline node_module* extra_linked_bindings_tail();
1220
- inline const Mutex& extra_linked_bindings_mutex() const;
1221
-
1222
- inline bool filehandle_close_warning() const;
1223
- inline void set_filehandle_close_warning(bool on);
1224
-
1225
- inline void set_source_maps_enabled(bool on);
1226
- inline bool source_maps_enabled() const;
1227
-
1228
- inline void ThrowError(const char* errmsg);
1229
- inline void ThrowTypeError(const char* errmsg);
1230
- inline void ThrowRangeError(const char* errmsg);
1231
- inline void ThrowErrnoException(int errorno,
1232
- const char* syscall = nullptr,
1233
- const char* message = nullptr,
1234
- const char* path = nullptr);
1235
- inline void ThrowUVException(int errorno,
1236
- const char* syscall = nullptr,
1237
- const char* message = nullptr,
1238
- const char* path = nullptr,
1239
- const char* dest = nullptr);
1240
-
1241
- inline v8::Local<v8::FunctionTemplate>
1242
- NewFunctionTemplate(v8::FunctionCallback callback,
1243
- v8::Local<v8::Signature> signature =
1244
- v8::Local<v8::Signature>(),
1245
- v8::ConstructorBehavior behavior =
1246
- v8::ConstructorBehavior::kAllow,
1247
- v8::SideEffectType side_effect =
1248
- v8::SideEffectType::kHasSideEffect);
1249
-
1250
- // Convenience methods for NewFunctionTemplate().
1251
- inline void SetMethod(v8::Local<v8::Object> that,
1252
- const char* name,
1253
- v8::FunctionCallback callback);
1254
-
1255
- inline void SetProtoMethod(v8::Local<v8::FunctionTemplate> that,
1256
- const char* name,
1257
- v8::FunctionCallback callback);
1258
-
1259
- inline void SetInstanceMethod(v8::Local<v8::FunctionTemplate> that,
1260
- const char* name,
1261
- v8::FunctionCallback callback);
1262
-
1263
-
1264
- // Safe variants denote the function has no side effects.
1265
- inline void SetMethodNoSideEffect(v8::Local<v8::Object> that,
1266
- const char* name,
1267
- v8::FunctionCallback callback);
1268
- inline void SetProtoMethodNoSideEffect(v8::Local<v8::FunctionTemplate> that,
1269
- const char* name,
1270
- v8::FunctionCallback callback);
1271
-
1272
- enum class SetConstructorFunctionFlag {
1273
- NONE,
1274
- SET_CLASS_NAME,
1275
- };
1276
-
1277
- inline void SetConstructorFunction(v8::Local<v8::Object> that,
1278
- const char* name,
1279
- v8::Local<v8::FunctionTemplate> tmpl,
1280
- SetConstructorFunctionFlag flag =
1281
- SetConstructorFunctionFlag::SET_CLASS_NAME);
1282
-
1283
- inline void SetConstructorFunction(v8::Local<v8::Object> that,
1284
- v8::Local<v8::String> name,
1285
- v8::Local<v8::FunctionTemplate> tmpl,
1286
- SetConstructorFunctionFlag flag =
1287
- SetConstructorFunctionFlag::SET_CLASS_NAME);
1288
-
1289
- void AtExit(void (*cb)(void* arg), void* arg);
1290
- void RunAtExitCallbacks();
1291
-
1292
- void RunWeakRefCleanup();
1293
-
1294
- // Strings and private symbols are shared across shared contexts
1295
- // The getters simply proxy to the per-isolate primitive.
1296
- #define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
1297
- #define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
1298
- #define VS(PropertyName, StringValue) V(v8::String, PropertyName)
1299
- #define V(TypeName, PropertyName) \
1300
- inline v8::Local<TypeName> PropertyName() const;
1301
- PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
1302
- PER_ISOLATE_SYMBOL_PROPERTIES(VY)
1303
- PER_ISOLATE_STRING_PROPERTIES(VS)
1304
- #undef V
1305
- #undef VS
1306
- #undef VY
1307
- #undef VP
1308
-
1309
- #define V(PropertyName, TypeName) \
1310
- inline v8::Local<TypeName> PropertyName() const; \
1311
- inline void set_ ## PropertyName(v8::Local<TypeName> value);
1312
- ENVIRONMENT_STRONG_PERSISTENT_VALUES(V)
1313
- ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V)
1314
- #undef V
1315
-
1316
- inline v8::Local<v8::Context> context() const;
1317
-
1318
- #if HAVE_INSPECTOR
1319
- inline inspector::Agent* inspector_agent() const {
1320
- return inspector_agent_.get();
1321
- }
1322
-
1323
- inline bool is_in_inspector_console_call() const;
1324
- inline void set_is_in_inspector_console_call(bool value);
1325
- #endif
1326
-
1327
- typedef ListHead<HandleWrap, &HandleWrap::handle_wrap_queue_> HandleWrapQueue;
1328
- typedef ListHead<ReqWrapBase, &ReqWrapBase::req_wrap_queue_> ReqWrapQueue;
1329
-
1330
- inline HandleWrapQueue* handle_wrap_queue() { return &handle_wrap_queue_; }
1331
- inline ReqWrapQueue* req_wrap_queue() { return &req_wrap_queue_; }
1332
-
1333
- inline bool EmitProcessEnvWarning() {
1334
- bool current_value = emit_env_nonstring_warning_;
1335
- emit_env_nonstring_warning_ = false;
1336
- return current_value;
1337
- }
1338
-
1339
- inline bool EmitErrNameWarning() {
1340
- bool current_value = emit_err_name_warning_;
1341
- emit_err_name_warning_ = false;
1342
- return current_value;
1343
- }
1344
-
1345
- // cb will be called as cb(env) on the next event loop iteration.
1346
- // Unlike the JS setImmediate() function, nested SetImmediate() calls will
1347
- // be run without returning control to the event loop, similar to nextTick().
1348
- template <typename Fn>
1349
- inline void SetImmediate(
1350
- Fn&& cb, CallbackFlags::Flags flags = CallbackFlags::kRefed);
1351
- template <typename Fn>
1352
- // This behaves like SetImmediate() but can be called from any thread.
1353
- inline void SetImmediateThreadsafe(
1354
- Fn&& cb, CallbackFlags::Flags flags = CallbackFlags::kRefed);
1355
- // This behaves like V8's Isolate::RequestInterrupt(), but also accounts for
1356
- // the event loop (i.e. combines the V8 function with SetImmediate()).
1357
- // The passed callback may not throw exceptions.
1358
- // This function can be called from any thread.
1359
- template <typename Fn>
1360
- inline void RequestInterrupt(Fn&& cb);
1361
- // This needs to be available for the JS-land setImmediate().
1362
- void ToggleImmediateRef(bool ref);
1363
-
1364
- inline void PushShouldNotAbortOnUncaughtScope();
1365
- inline void PopShouldNotAbortOnUncaughtScope();
1366
- inline bool inside_should_not_abort_on_uncaught_scope() const;
1367
-
1368
- static inline Environment* ForAsyncHooks(AsyncHooks* hooks);
1369
-
1370
- v8::Local<v8::Value> GetNow();
1371
- void ScheduleTimer(int64_t duration);
1372
- void ToggleTimerRef(bool ref);
1373
-
1374
- using CleanupCallback = CleanupHookCallback::Callback;
1375
- inline void AddCleanupHook(CleanupCallback cb, void* arg);
1376
- inline void RemoveCleanupHook(CleanupCallback cb, void* arg);
1377
- void RunCleanup();
1378
-
1379
- static size_t NearHeapLimitCallback(void* data,
1380
- size_t current_heap_limit,
1381
- size_t initial_heap_limit);
1382
- static void BuildEmbedderGraph(v8::Isolate* isolate,
1383
- v8::EmbedderGraph* graph,
1384
- void* data);
1385
-
1386
- inline std::shared_ptr<EnvironmentOptions> options();
1387
- inline std::shared_ptr<ExclusiveAccess<HostPort>> inspector_host_port();
1388
-
1389
- // The BaseObject count is a debugging helper that makes sure that there are
1390
- // no memory leaks caused by BaseObjects staying alive longer than expected
1391
- // (in particular, no circular BaseObjectPtr references).
1392
- inline void modify_base_object_count(int64_t delta);
1393
- inline int64_t base_object_created_after_bootstrap() const;
1394
- inline int64_t base_object_count() const;
1395
-
1396
- inline int32_t stack_trace_limit() const { return 10; }
1397
-
1398
- #if HAVE_INSPECTOR
1399
- void set_coverage_connection(
1400
- std::unique_ptr<profiler::V8CoverageConnection> connection);
1401
- profiler::V8CoverageConnection* coverage_connection();
1402
-
1403
- inline void set_coverage_directory(const char* directory);
1404
- inline const std::string& coverage_directory() const;
1405
-
1406
- void set_cpu_profiler_connection(
1407
- std::unique_ptr<profiler::V8CpuProfilerConnection> connection);
1408
- profiler::V8CpuProfilerConnection* cpu_profiler_connection();
1409
-
1410
- inline void set_cpu_prof_name(const std::string& name);
1411
- inline const std::string& cpu_prof_name() const;
1412
-
1413
- inline void set_cpu_prof_interval(uint64_t interval);
1414
- inline uint64_t cpu_prof_interval() const;
1415
-
1416
- inline void set_cpu_prof_dir(const std::string& dir);
1417
- inline const std::string& cpu_prof_dir() const;
1418
-
1419
- void set_heap_profiler_connection(
1420
- std::unique_ptr<profiler::V8HeapProfilerConnection> connection);
1421
- profiler::V8HeapProfilerConnection* heap_profiler_connection();
1422
-
1423
- inline void set_heap_prof_name(const std::string& name);
1424
- inline const std::string& heap_prof_name() const;
1425
-
1426
- inline void set_heap_prof_dir(const std::string& dir);
1427
- inline const std::string& heap_prof_dir() const;
1428
-
1429
- inline void set_heap_prof_interval(uint64_t interval);
1430
- inline uint64_t heap_prof_interval() const;
1431
-
1432
- #endif // HAVE_INSPECTOR
1433
-
1434
- inline void set_main_utf16(std::unique_ptr<v8::String::Value>);
1435
- inline void set_process_exit_handler(
1436
- std::function<void(Environment*, int)>&& handler);
1437
-
1438
- void RunAndClearNativeImmediates(bool only_refed = false);
1439
- void RunAndClearInterrupts();
1440
-
1441
- inline uv_buf_t allocate_managed_buffer(const size_t suggested_size);
1442
- inline std::unique_ptr<v8::BackingStore> release_managed_buffer(
1443
- const uv_buf_t& buf);
1444
- inline std::unordered_map<char*, std::unique_ptr<v8::BackingStore>>*
1445
- released_allocated_buffers();
1446
-
1447
- void AddUnmanagedFd(int fd);
1448
- void RemoveUnmanagedFd(int fd);
1449
-
1450
- template <typename T>
1451
- void ForEachBindingData(T&& iterator);
1452
-
1453
- private:
1454
- inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
1455
- const char* errmsg);
1456
-
1457
- std::list<binding::DLib> loaded_addons_;
1458
- v8::Isolate* const isolate_;
1459
- IsolateData* const isolate_data_;
1460
- uv_timer_t timer_handle_;
1461
- uv_check_t immediate_check_handle_;
1462
- uv_idle_t immediate_idle_handle_;
1463
- uv_prepare_t idle_prepare_handle_;
1464
- uv_check_t idle_check_handle_;
1465
- uv_async_t task_queues_async_;
1466
- int64_t task_queues_async_refs_ = 0;
1467
-
1468
- AsyncHooks async_hooks_;
1469
- ImmediateInfo immediate_info_;
1470
- TickInfo tick_info_;
1471
- const uint64_t timer_base_;
1472
- std::shared_ptr<KVStore> env_vars_;
1473
- bool printed_error_ = false;
1474
- bool trace_sync_io_ = false;
1475
- bool emit_env_nonstring_warning_ = true;
1476
- bool emit_err_name_warning_ = true;
1477
- bool emit_filehandle_warning_ = true;
1478
- bool source_maps_enabled_ = false;
1479
-
1480
- size_t async_callback_scope_depth_ = 0;
1481
- std::vector<double> destroy_async_id_list_;
1482
-
1483
- #if HAVE_INSPECTOR
1484
- std::unique_ptr<profiler::V8CoverageConnection> coverage_connection_;
1485
- std::unique_ptr<profiler::V8CpuProfilerConnection> cpu_profiler_connection_;
1486
- std::string coverage_directory_;
1487
- std::string cpu_prof_dir_;
1488
- std::string cpu_prof_name_;
1489
- uint64_t cpu_prof_interval_;
1490
- std::unique_ptr<profiler::V8HeapProfilerConnection> heap_profiler_connection_;
1491
- std::string heap_prof_dir_;
1492
- std::string heap_prof_name_;
1493
- uint64_t heap_prof_interval_;
1494
- #endif // HAVE_INSPECTOR
1495
-
1496
- std::shared_ptr<EnvironmentOptions> options_;
1497
- // options_ contains debug options parsed from CLI arguments,
1498
- // while inspector_host_port_ stores the actual inspector host
1499
- // and port being used. For example the port is -1 by default
1500
- // and can be specified as 0 (meaning any port allocated when the
1501
- // server starts listening), but when the inspector server starts
1502
- // the inspector_host_port_->port() will be the actual port being
1503
- // used.
1504
- std::shared_ptr<ExclusiveAccess<HostPort>> inspector_host_port_;
1505
- std::vector<std::string> exec_argv_;
1506
- std::vector<std::string> argv_;
1507
- std::string exec_path_;
1508
-
1509
- bool is_processing_heap_limit_callback_ = false;
1510
- int64_t heap_limit_snapshot_taken_ = 0;
1511
-
1512
- uint32_t module_id_counter_ = 0;
1513
- uint32_t script_id_counter_ = 0;
1514
- uint32_t function_id_counter_ = 0;
1515
-
1516
- AliasedUint32Array should_abort_on_uncaught_toggle_;
1517
- int should_not_abort_scope_counter_ = 0;
1518
-
1519
- std::unique_ptr<TrackingTraceStateObserver> trace_state_observer_;
1520
-
1521
- AliasedInt32Array stream_base_state_;
1522
-
1523
- uint64_t environment_start_time_;
1524
- std::unique_ptr<performance::PerformanceState> performance_state_;
1525
-
1526
- bool has_run_bootstrapping_code_ = false;
1527
- bool has_serialized_options_ = false;
1528
-
1529
- std::atomic_bool can_call_into_js_ { true };
1530
- uint64_t flags_;
1531
- uint64_t thread_id_;
1532
- std::unordered_set<worker::Worker*> sub_worker_contexts_;
1533
-
1534
- static void* const kNodeContextTagPtr;
1535
- static int const kNodeContextTag;
1536
-
1537
- #if HAVE_INSPECTOR
1538
- std::unique_ptr<inspector::Agent> inspector_agent_;
1539
- bool is_in_inspector_console_call_ = false;
1540
- #endif
1541
-
1542
- std::list<DeserializeRequest> deserialize_requests_;
1543
-
1544
- // handle_wrap_queue_ and req_wrap_queue_ needs to be at a fixed offset from
1545
- // the start of the class because it is used by
1546
- // src/node_postmortem_metadata.cc to calculate offsets and generate debug
1547
- // symbols for Environment, which assumes that the position of members in
1548
- // memory are predictable. For more information please refer to
1549
- // `doc/guides/node-postmortem-support.md`
1550
- friend int GenDebugSymbols();
1551
- HandleWrapQueue handle_wrap_queue_;
1552
- ReqWrapQueue req_wrap_queue_;
1553
- std::list<HandleCleanup> handle_cleanup_queue_;
1554
- int handle_cleanup_waiting_ = 0;
1555
- int request_waiting_ = 0;
1556
-
1557
- EnabledDebugList enabled_debug_list_;
1558
-
1559
- std::list<node_module> extra_linked_bindings_;
1560
- Mutex extra_linked_bindings_mutex_;
1561
-
1562
- static void RunTimers(uv_timer_t* handle);
1563
-
1564
- struct ExitCallback {
1565
- void (*cb_)(void* arg);
1566
- void* arg_;
1567
- };
1568
-
1569
- std::list<ExitCallback> at_exit_functions_;
1570
-
1571
- typedef CallbackQueue<void, Environment*> NativeImmediateQueue;
1572
- NativeImmediateQueue native_immediates_;
1573
- Mutex native_immediates_threadsafe_mutex_;
1574
- NativeImmediateQueue native_immediates_threadsafe_;
1575
- NativeImmediateQueue native_immediates_interrupts_;
1576
- // Also guarded by native_immediates_threadsafe_mutex_. This can be used when
1577
- // trying to post tasks from other threads to an Environment, as the libuv
1578
- // handle for the immediate queues (task_queues_async_) may not be initialized
1579
- // yet or already have been destroyed.
1580
- bool task_queues_async_initialized_ = false;
1581
-
1582
- std::atomic<Environment**> interrupt_data_ {nullptr};
1583
- void RequestInterruptFromV8();
1584
- static void CheckImmediate(uv_check_t* handle);
1585
-
1586
- BindingDataStore bindings_;
1587
-
1588
- // Use an unordered_set, so that we have efficient insertion and removal.
1589
- std::unordered_set<CleanupHookCallback,
1590
- CleanupHookCallback::Hash,
1591
- CleanupHookCallback::Equal> cleanup_hooks_;
1592
- uint64_t cleanup_hook_counter_ = 0;
1593
- bool started_cleanup_ = false;
1594
-
1595
- int64_t base_object_count_ = 0;
1596
- int64_t base_object_created_by_bootstrap_ = 0;
1597
- std::atomic_bool is_stopping_ { false };
1598
-
1599
- std::unordered_set<int> unmanaged_fds_;
1600
-
1601
- std::function<void(Environment*, int)> process_exit_handler_ {
1602
- DefaultProcessExitHandler };
1603
-
1604
- template <typename T>
1605
- void ForEachBaseObject(T&& iterator);
1606
-
1607
- #define V(PropertyName, TypeName) v8::Global<TypeName> PropertyName ## _;
1608
- ENVIRONMENT_STRONG_PERSISTENT_VALUES(V)
1609
- ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V)
1610
- #undef V
1611
-
1612
- v8::Global<v8::Context> context_;
1613
-
1614
- // Keeps the main script source alive is one was passed to LoadEnvironment().
1615
- // We should probably find a way to just use plain `v8::String`s created from
1616
- // the source passed to LoadEnvironment() directly instead.
1617
- std::unique_ptr<v8::String::Value> main_utf16_;
1618
-
1619
- // Used by AllocatedBuffer::release() to keep track of the BackingStore for
1620
- // a given pointer.
1621
- std::unordered_map<char*, std::unique_ptr<v8::BackingStore>>
1622
- released_allocated_buffers_;
1623
- };
1624
-
1625
- } // namespace node
1626
-
1627
- #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
1628
-
1629
- #endif // SRC_ENV_H_