@kungfu-tech/libnode-win32-x64 0.0.0-bootstrap.0 → 22.22.3-kf.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 (343) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/dist/node/include/acorn_version.h +6 -0
  4. package/dist/node/include/aliased_buffer-inl.h +244 -0
  5. package/dist/node/include/aliased_buffer.h +206 -0
  6. package/dist/node/include/aliased_struct-inl.h +54 -0
  7. package/dist/node/include/aliased_struct.h +63 -0
  8. package/dist/node/include/amaro_version.h +6 -0
  9. package/dist/node/include/async_context_frame.h +33 -0
  10. package/dist/node/include/async_wrap-inl.h +96 -0
  11. package/dist/node/include/async_wrap.h +243 -0
  12. package/dist/node/include/base_object-inl.h +335 -0
  13. package/dist/node/include/base_object.h +342 -0
  14. package/dist/node/include/base_object_types.h +74 -0
  15. package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
  16. package/dist/node/include/blob_serializer_deserializer.h +132 -0
  17. package/dist/node/include/callback_queue-inl.h +97 -0
  18. package/dist/node/include/callback_queue.h +79 -0
  19. package/dist/node/include/cares_wrap.h +447 -0
  20. package/dist/node/include/cjs_module_lexer_version.h +6 -0
  21. package/dist/node/include/cleanup_queue-inl.h +36 -0
  22. package/dist/node/include/cleanup_queue.h +79 -0
  23. package/dist/node/include/compile_cache.h +104 -0
  24. package/dist/node/include/connect_wrap.h +26 -0
  25. package/dist/node/include/connection_wrap.h +30 -0
  26. package/dist/node/include/cppgc/allocation.h +310 -0
  27. package/dist/node/include/cppgc/common.h +28 -0
  28. package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
  29. package/dist/node/include/cppgc/custom-space.h +97 -0
  30. package/dist/node/include/cppgc/default-platform.h +67 -0
  31. package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
  32. package/dist/node/include/cppgc/explicit-management.h +100 -0
  33. package/dist/node/include/cppgc/garbage-collected.h +106 -0
  34. package/dist/node/include/cppgc/heap-consistency.h +309 -0
  35. package/dist/node/include/cppgc/heap-handle.h +48 -0
  36. package/dist/node/include/cppgc/heap-state.h +82 -0
  37. package/dist/node/include/cppgc/heap-statistics.h +120 -0
  38. package/dist/node/include/cppgc/heap.h +202 -0
  39. package/dist/node/include/cppgc/internal/api-constants.h +87 -0
  40. package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
  41. package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
  42. package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
  43. package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
  44. package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
  45. package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
  46. package/dist/node/include/cppgc/internal/gc-info.h +148 -0
  47. package/dist/node/include/cppgc/internal/logging.h +50 -0
  48. package/dist/node/include/cppgc/internal/member-storage.h +256 -0
  49. package/dist/node/include/cppgc/internal/name-trait.h +137 -0
  50. package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
  51. package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
  52. package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
  53. package/dist/node/include/cppgc/liveness-broker.h +78 -0
  54. package/dist/node/include/cppgc/macros.h +35 -0
  55. package/dist/node/include/cppgc/member.h +629 -0
  56. package/dist/node/include/cppgc/name-provider.h +65 -0
  57. package/dist/node/include/cppgc/object-size-trait.h +58 -0
  58. package/dist/node/include/cppgc/persistent.h +377 -0
  59. package/dist/node/include/cppgc/platform.h +163 -0
  60. package/dist/node/include/cppgc/prefinalizer.h +75 -0
  61. package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
  62. package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
  63. package/dist/node/include/cppgc/source-location.h +16 -0
  64. package/dist/node/include/cppgc/testing.h +106 -0
  65. package/dist/node/include/cppgc/trace-trait.h +128 -0
  66. package/dist/node/include/cppgc/type-traits.h +271 -0
  67. package/dist/node/include/cppgc/visitor.h +504 -0
  68. package/dist/node/include/crypto/crypto_aes.h +88 -0
  69. package/dist/node/include/crypto/crypto_bio.h +193 -0
  70. package/dist/node/include/crypto/crypto_cipher.h +293 -0
  71. package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
  72. package/dist/node/include/crypto/crypto_clienthello.h +131 -0
  73. package/dist/node/include/crypto/crypto_common.h +64 -0
  74. package/dist/node/include/crypto/crypto_context.h +171 -0
  75. package/dist/node/include/crypto/crypto_dh.h +126 -0
  76. package/dist/node/include/crypto/crypto_dsa.h +52 -0
  77. package/dist/node/include/crypto/crypto_ec.h +164 -0
  78. package/dist/node/include/crypto/crypto_hash.h +91 -0
  79. package/dist/node/include/crypto/crypto_hkdf.h +61 -0
  80. package/dist/node/include/crypto/crypto_hmac.h +92 -0
  81. package/dist/node/include/crypto/crypto_keygen.h +299 -0
  82. package/dist/node/include/crypto/crypto_keys.h +392 -0
  83. package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
  84. package/dist/node/include/crypto/crypto_random.h +124 -0
  85. package/dist/node/include/crypto/crypto_rsa.h +136 -0
  86. package/dist/node/include/crypto/crypto_scrypt.h +85 -0
  87. package/dist/node/include/crypto/crypto_sig.h +165 -0
  88. package/dist/node/include/crypto/crypto_spkac.h +21 -0
  89. package/dist/node/include/crypto/crypto_timing.h +20 -0
  90. package/dist/node/include/crypto/crypto_tls.h +305 -0
  91. package/dist/node/include/crypto/crypto_util.h +725 -0
  92. package/dist/node/include/crypto/crypto_x509.h +140 -0
  93. package/dist/node/include/dataqueue/queue.h +306 -0
  94. package/dist/node/include/debug_utils-inl.h +278 -0
  95. package/dist/node/include/debug_utils.h +196 -0
  96. package/dist/node/include/diagnosticfilename-inl.h +33 -0
  97. package/dist/node/include/embedded_data.h +17 -0
  98. package/dist/node/include/encoding_binding.h +61 -0
  99. package/dist/node/include/env-inl.h +984 -0
  100. package/dist/node/include/env.h +1287 -0
  101. package/dist/node/include/env_properties.h +540 -0
  102. package/dist/node/include/handle_wrap.h +123 -0
  103. package/dist/node/include/histogram-inl.h +107 -0
  104. package/dist/node/include/histogram.h +279 -0
  105. package/dist/node/include/inspector/io_agent.h +30 -0
  106. package/dist/node/include/inspector/main_thread_interface.h +116 -0
  107. package/dist/node/include/inspector/network_agent.h +94 -0
  108. package/dist/node/include/inspector/network_inspector.h +45 -0
  109. package/dist/node/include/inspector/network_requests_buffer.h +195 -0
  110. package/dist/node/include/inspector/network_resource_manager.h +29 -0
  111. package/dist/node/include/inspector/node_json.h +24 -0
  112. package/dist/node/include/inspector/node_string.h +101 -0
  113. package/dist/node/include/inspector/protocol_helper.h +27 -0
  114. package/dist/node/include/inspector/runtime_agent.h +41 -0
  115. package/dist/node/include/inspector/target_agent.h +75 -0
  116. package/dist/node/include/inspector/tracing_agent.h +43 -0
  117. package/dist/node/include/inspector/worker_agent.h +40 -0
  118. package/dist/node/include/inspector/worker_inspector.h +124 -0
  119. package/dist/node/include/inspector_agent.h +165 -0
  120. package/dist/node/include/inspector_io.h +78 -0
  121. package/dist/node/include/inspector_profiler.h +149 -0
  122. package/dist/node/include/inspector_socket.h +60 -0
  123. package/dist/node/include/inspector_socket_server.h +110 -0
  124. package/dist/node/include/js_native_api.h +607 -0
  125. package/dist/node/include/js_native_api_types.h +226 -0
  126. package/dist/node/include/js_native_api_v8.h +485 -0
  127. package/dist/node/include/js_native_api_v8_internals.h +45 -0
  128. package/dist/node/include/js_stream.h +52 -0
  129. package/dist/node/include/json_utils.h +172 -0
  130. package/dist/node/include/large_pages/node_large_page.h +34 -0
  131. package/dist/node/include/libplatform/libplatform-export.h +29 -0
  132. package/dist/node/include/libplatform/libplatform.h +112 -0
  133. package/dist/node/include/libplatform/v8-tracing.h +333 -0
  134. package/dist/node/include/memory_tracker-inl.h +359 -0
  135. package/dist/node/include/memory_tracker.h +289 -0
  136. package/dist/node/include/module_wrap.h +216 -0
  137. package/dist/node/include/node.h +1593 -0
  138. package/dist/node/include/node_api.h +265 -0
  139. package/dist/node/include/node_api_internals.h +48 -0
  140. package/dist/node/include/node_api_types.h +56 -0
  141. package/dist/node/include/node_binding.h +161 -0
  142. package/dist/node/include/node_blob.h +159 -0
  143. package/dist/node/include/node_bob-inl.h +36 -0
  144. package/dist/node/include/node_bob.h +107 -0
  145. package/dist/node/include/node_buffer.h +92 -0
  146. package/dist/node/include/node_builtins.h +220 -0
  147. package/dist/node/include/node_config_file.h +46 -0
  148. package/dist/node/include/node_constants.h +82 -0
  149. package/dist/node/include/node_context_data.h +168 -0
  150. package/dist/node/include/node_contextify.h +204 -0
  151. package/dist/node/include/node_crypto.h +56 -0
  152. package/dist/node/include/node_debug.h +30 -0
  153. package/dist/node/include/node_dir.h +52 -0
  154. package/dist/node/include/node_dotenv.h +45 -0
  155. package/dist/node/include/node_errors.h +380 -0
  156. package/dist/node/include/node_exit_code.h +54 -0
  157. package/dist/node/include/node_external_reference.h +165 -0
  158. package/dist/node/include/node_file-inl.h +406 -0
  159. package/dist/node/include/node_file.h +537 -0
  160. package/dist/node/include/node_http2.h +1177 -0
  161. package/dist/node/include/node_http2_state.h +159 -0
  162. package/dist/node/include/node_http_common-inl.h +202 -0
  163. package/dist/node/include/node_http_common.h +535 -0
  164. package/dist/node/include/node_i18n.h +132 -0
  165. package/dist/node/include/node_internals.h +483 -0
  166. package/dist/node/include/node_main_instance.h +67 -0
  167. package/dist/node/include/node_mem-inl.h +113 -0
  168. package/dist/node/include/node_mem.h +45 -0
  169. package/dist/node/include/node_messaging.h +389 -0
  170. package/dist/node/include/node_metadata.h +164 -0
  171. package/dist/node/include/node_modules.h +91 -0
  172. package/dist/node/include/node_mutex.h +323 -0
  173. package/dist/node/include/node_object_wrap.h +132 -0
  174. package/dist/node/include/node_options-inl.h +490 -0
  175. package/dist/node/include/node_options.h +615 -0
  176. package/dist/node/include/node_perf.h +166 -0
  177. package/dist/node/include/node_perf_common.h +102 -0
  178. package/dist/node/include/node_platform.h +238 -0
  179. package/dist/node/include/node_process-inl.h +26 -0
  180. package/dist/node/include/node_process.h +112 -0
  181. package/dist/node/include/node_realm-inl.h +151 -0
  182. package/dist/node/include/node_realm.h +183 -0
  183. package/dist/node/include/node_report.h +43 -0
  184. package/dist/node/include/node_revert.h +82 -0
  185. package/dist/node/include/node_root_certs.h +3520 -0
  186. package/dist/node/include/node_sea.h +74 -0
  187. package/dist/node/include/node_shadow_realm.h +46 -0
  188. package/dist/node/include/node_snapshot_builder.h +57 -0
  189. package/dist/node/include/node_snapshotable.h +174 -0
  190. package/dist/node/include/node_sockaddr-inl.h +257 -0
  191. package/dist/node/include/node_sockaddr.h +394 -0
  192. package/dist/node/include/node_sqlite.h +270 -0
  193. package/dist/node/include/node_stat_watcher.h +73 -0
  194. package/dist/node/include/node_task_runner.h +92 -0
  195. package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
  196. package/dist/node/include/node_threadsafe_cow.h +105 -0
  197. package/dist/node/include/node_union_bytes.h +81 -0
  198. package/dist/node/include/node_url.h +96 -0
  199. package/dist/node/include/node_v8.h +77 -0
  200. package/dist/node/include/node_v8_platform-inl.h +185 -0
  201. package/dist/node/include/node_version.h +110 -0
  202. package/dist/node/include/node_wasi.h +184 -0
  203. package/dist/node/include/node_wasm_web_api.h +55 -0
  204. package/dist/node/include/node_watchdog.h +154 -0
  205. package/dist/node/include/node_webstorage.h +60 -0
  206. package/dist/node/include/node_worker.h +158 -0
  207. package/dist/node/include/path.h +33 -0
  208. package/dist/node/include/permission/addon_permission.h +31 -0
  209. package/dist/node/include/permission/child_process_permission.h +31 -0
  210. package/dist/node/include/permission/fs_permission.h +167 -0
  211. package/dist/node/include/permission/inspector_permission.h +31 -0
  212. package/dist/node/include/permission/permission.h +138 -0
  213. package/dist/node/include/permission/permission_base.h +65 -0
  214. package/dist/node/include/permission/wasi_permission.h +31 -0
  215. package/dist/node/include/permission/worker_permission.h +31 -0
  216. package/dist/node/include/pipe_wrap.h +80 -0
  217. package/dist/node/include/quic/application.h +159 -0
  218. package/dist/node/include/quic/bindingdata.h +272 -0
  219. package/dist/node/include/quic/cid.h +127 -0
  220. package/dist/node/include/quic/data.h +148 -0
  221. package/dist/node/include/quic/defs.h +245 -0
  222. package/dist/node/include/quic/endpoint.h +458 -0
  223. package/dist/node/include/quic/http3.h +15 -0
  224. package/dist/node/include/quic/logstream.h +81 -0
  225. package/dist/node/include/quic/packet.h +152 -0
  226. package/dist/node/include/quic/preferredaddress.h +72 -0
  227. package/dist/node/include/quic/session.h +443 -0
  228. package/dist/node/include/quic/sessionticket.h +108 -0
  229. package/dist/node/include/quic/streams.h +232 -0
  230. package/dist/node/include/quic/tlscontext.h +227 -0
  231. package/dist/node/include/quic/tokens.h +256 -0
  232. package/dist/node/include/quic/transportparams.h +165 -0
  233. package/dist/node/include/req_wrap-inl.h +171 -0
  234. package/dist/node/include/req_wrap.h +77 -0
  235. package/dist/node/include/spawn_sync.h +243 -0
  236. package/dist/node/include/stream_base-inl.h +173 -0
  237. package/dist/node/include/stream_base.h +478 -0
  238. package/dist/node/include/stream_pipe.h +76 -0
  239. package/dist/node/include/stream_wrap.h +132 -0
  240. package/dist/node/include/string_bytes.h +113 -0
  241. package/dist/node/include/string_decoder-inl.h +31 -0
  242. package/dist/node/include/string_decoder.h +49 -0
  243. package/dist/node/include/tcp_wrap.h +105 -0
  244. package/dist/node/include/threadpoolwork-inl.h +70 -0
  245. package/dist/node/include/timer_wrap-inl.h +32 -0
  246. package/dist/node/include/timer_wrap.h +85 -0
  247. package/dist/node/include/timers.h +70 -0
  248. package/dist/node/include/tracing/agent.h +195 -0
  249. package/dist/node/include/tracing/node_trace_buffer.h +83 -0
  250. package/dist/node/include/tracing/node_trace_writer.h +75 -0
  251. package/dist/node/include/tracing/trace_event.h +722 -0
  252. package/dist/node/include/tracing/trace_event_common.h +1109 -0
  253. package/dist/node/include/tracing/traced_value.h +129 -0
  254. package/dist/node/include/tty_wrap.h +65 -0
  255. package/dist/node/include/udp_wrap.h +230 -0
  256. package/dist/node/include/undici_version.h +6 -0
  257. package/dist/node/include/util-inl.h +700 -0
  258. package/dist/node/include/util.h +1021 -0
  259. package/dist/node/include/uv/aix.h +32 -0
  260. package/dist/node/include/uv/bsd.h +34 -0
  261. package/dist/node/include/uv/darwin.h +61 -0
  262. package/dist/node/include/uv/errno.h +483 -0
  263. package/dist/node/include/uv/linux.h +34 -0
  264. package/dist/node/include/uv/os390.h +33 -0
  265. package/dist/node/include/uv/posix.h +31 -0
  266. package/dist/node/include/uv/sunos.h +44 -0
  267. package/dist/node/include/uv/threadpool.h +37 -0
  268. package/dist/node/include/uv/tree.h +521 -0
  269. package/dist/node/include/uv/unix.h +512 -0
  270. package/dist/node/include/uv/version.h +43 -0
  271. package/dist/node/include/uv/win.h +698 -0
  272. package/dist/node/include/uv.h +1990 -0
  273. package/dist/node/include/v8-array-buffer.h +525 -0
  274. package/dist/node/include/v8-callbacks.h +462 -0
  275. package/dist/node/include/v8-container.h +183 -0
  276. package/dist/node/include/v8-context.h +485 -0
  277. package/dist/node/include/v8-cppgc.h +245 -0
  278. package/dist/node/include/v8-data.h +80 -0
  279. package/dist/node/include/v8-date.h +48 -0
  280. package/dist/node/include/v8-debug.h +168 -0
  281. package/dist/node/include/v8-embedder-heap.h +82 -0
  282. package/dist/node/include/v8-embedder-state-scope.h +52 -0
  283. package/dist/node/include/v8-exception.h +223 -0
  284. package/dist/node/include/v8-extension.h +62 -0
  285. package/dist/node/include/v8-external.h +37 -0
  286. package/dist/node/include/v8-fast-api-calls.h +984 -0
  287. package/dist/node/include/v8-forward.h +82 -0
  288. package/dist/node/include/v8-function-callback.h +607 -0
  289. package/dist/node/include/v8-function.h +140 -0
  290. package/dist/node/include/v8-handle-base.h +137 -0
  291. package/dist/node/include/v8-initialization.h +289 -0
  292. package/dist/node/include/v8-inspector-protocol.h +13 -0
  293. package/dist/node/include/v8-inspector.h +419 -0
  294. package/dist/node/include/v8-internal.h +1397 -0
  295. package/dist/node/include/v8-isolate.h +1767 -0
  296. package/dist/node/include/v8-json.h +47 -0
  297. package/dist/node/include/v8-local-handle.h +758 -0
  298. package/dist/node/include/v8-locker.h +138 -0
  299. package/dist/node/include/v8-maybe.h +160 -0
  300. package/dist/node/include/v8-memory-span.h +198 -0
  301. package/dist/node/include/v8-message.h +233 -0
  302. package/dist/node/include/v8-metrics.h +264 -0
  303. package/dist/node/include/v8-microtask-queue.h +157 -0
  304. package/dist/node/include/v8-microtask.h +28 -0
  305. package/dist/node/include/v8-object.h +824 -0
  306. package/dist/node/include/v8-persistent-handle.h +582 -0
  307. package/dist/node/include/v8-platform.h +1358 -0
  308. package/dist/node/include/v8-primitive-object.h +118 -0
  309. package/dist/node/include/v8-primitive.h +877 -0
  310. package/dist/node/include/v8-profiler.h +1302 -0
  311. package/dist/node/include/v8-promise.h +174 -0
  312. package/dist/node/include/v8-proxy.h +50 -0
  313. package/dist/node/include/v8-regexp.h +106 -0
  314. package/dist/node/include/v8-script.h +904 -0
  315. package/dist/node/include/v8-snapshot.h +266 -0
  316. package/dist/node/include/v8-source-location.h +92 -0
  317. package/dist/node/include/v8-statistics.h +238 -0
  318. package/dist/node/include/v8-template.h +1297 -0
  319. package/dist/node/include/v8-traced-handle.h +432 -0
  320. package/dist/node/include/v8-typed-array.h +390 -0
  321. package/dist/node/include/v8-unwinder-state.h +31 -0
  322. package/dist/node/include/v8-unwinder.h +132 -0
  323. package/dist/node/include/v8-util.h +665 -0
  324. package/dist/node/include/v8-value-serializer-version.h +24 -0
  325. package/dist/node/include/v8-value-serializer.h +316 -0
  326. package/dist/node/include/v8-value.h +655 -0
  327. package/dist/node/include/v8-version-string.h +38 -0
  328. package/dist/node/include/v8-version.h +20 -0
  329. package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
  330. package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
  331. package/dist/node/include/v8-wasm.h +201 -0
  332. package/dist/node/include/v8-weak-callback-info.h +80 -0
  333. package/dist/node/include/v8.h +88 -0
  334. package/dist/node/include/v8config.h +981 -0
  335. package/dist/node/include/zlib_version.h +6 -0
  336. package/dist/node/libnode.dll +0 -0
  337. package/dist/node/libnode.lib +0 -0
  338. package/dist/node/libnodebuildinfo.json +10 -0
  339. package/dist/node/link_node.lib +0 -0
  340. package/dist/node/link_node.node +0 -0
  341. package/index.js +5 -0
  342. package/libnode.release.json +8 -0
  343. package/package.json +29 -1
@@ -0,0 +1,123 @@
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_HANDLE_WRAP_H_
23
+ #define SRC_HANDLE_WRAP_H_
24
+
25
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
+
27
+ #include "async_wrap.h"
28
+ #include "util.h"
29
+ #include "uv.h"
30
+ #include "v8.h"
31
+
32
+ namespace node {
33
+
34
+ class Environment;
35
+ class ExternalReferenceRegistry;
36
+
37
+ // Rules:
38
+ //
39
+ // - Do not throw from handle methods. Set errno.
40
+ //
41
+ // - MakeCallback may only be made directly off the event loop.
42
+ // That is there can be no JavaScript stack frames underneath it.
43
+ // (Is there any way to assert that?)
44
+ //
45
+ // - No use of v8::WeakReferenceCallback. The close callback signifies that
46
+ // we're done with a handle - external resources can be freed.
47
+ //
48
+ // - Reusable?
49
+ //
50
+ // - The uv_close_cb is used to free the c++ object. The close callback
51
+ // is not made into javascript land.
52
+ //
53
+ // - uv_ref, uv_unref counts are managed at this layer to avoid needless
54
+ // js/c++ boundary crossing. At the javascript layer that should all be
55
+ // taken care of.
56
+
57
+ class HandleWrap : public AsyncWrap {
58
+ public:
59
+ static void Close(const v8::FunctionCallbackInfo<v8::Value>& args);
60
+ static void Ref(const v8::FunctionCallbackInfo<v8::Value>& args);
61
+ static void Unref(const v8::FunctionCallbackInfo<v8::Value>& args);
62
+ static void HasRef(const v8::FunctionCallbackInfo<v8::Value>& args);
63
+
64
+ static inline bool IsAlive(const HandleWrap* wrap) {
65
+ return wrap != nullptr &&
66
+ wrap->IsDoneInitializing() &&
67
+ wrap->state_ != kClosed;
68
+ }
69
+
70
+ static inline bool HasRef(const HandleWrap* wrap) {
71
+ return IsAlive(wrap) && uv_has_ref(wrap->GetHandle());
72
+ }
73
+
74
+ inline uv_handle_t* GetHandle() const { return handle_; }
75
+
76
+ virtual void Close(
77
+ v8::Local<v8::Value> close_callback = v8::Local<v8::Value>());
78
+
79
+ static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
80
+ IsolateData* isolate_data);
81
+ static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
82
+ Environment* env);
83
+ static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
84
+
85
+ protected:
86
+ HandleWrap(Environment* env,
87
+ v8::Local<v8::Object> object,
88
+ uv_handle_t* handle,
89
+ AsyncWrap::ProviderType provider);
90
+ virtual void OnClose() {}
91
+ void OnGCCollect() final;
92
+ bool IsNotIndicativeOfMemoryLeakAtExit() const override;
93
+
94
+ void MarkAsInitialized();
95
+ void MarkAsUninitialized();
96
+
97
+ inline bool IsHandleClosing() const {
98
+ return state_ == kClosing || state_ == kClosed;
99
+ }
100
+
101
+ static void OnClose(uv_handle_t* handle);
102
+ enum { kInitialized, kClosing, kClosed } state_;
103
+
104
+ private:
105
+ friend class Environment;
106
+ friend void GetActiveHandles(const v8::FunctionCallbackInfo<v8::Value>&);
107
+
108
+ // handle_wrap_queue_ needs to be at a fixed offset from the start of the
109
+ // class because it is used by src/node_postmortem_metadata.cc to calculate
110
+ // offsets and generate debug symbols for HandleWrap, which assumes that the
111
+ // position of members in memory are predictable. For more information please
112
+ // refer to `doc/contributing/node-postmortem-support.md`
113
+ friend int GenDebugSymbols();
114
+ ListNode<HandleWrap> handle_wrap_queue_;
115
+ uv_handle_t* const handle_;
116
+ };
117
+
118
+
119
+ } // namespace node
120
+
121
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
122
+
123
+ #endif // SRC_HANDLE_WRAP_H_
@@ -0,0 +1,107 @@
1
+ #ifndef SRC_HISTOGRAM_INL_H_
2
+ #define SRC_HISTOGRAM_INL_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include "histogram.h"
7
+ #include "base_object-inl.h"
8
+ #include "node_internals.h"
9
+
10
+ namespace node {
11
+
12
+ void Histogram::Reset() {
13
+ Mutex::ScopedLock lock(mutex_);
14
+ hdr_reset(histogram_.get());
15
+ exceeds_ = 0;
16
+ count_ = 0;
17
+ prev_ = 0;
18
+ }
19
+
20
+ double Histogram::Add(const Histogram& other) {
21
+ Mutex::ScopedLock lock(mutex_);
22
+ count_ += other.count_;
23
+ exceeds_ += other.exceeds_;
24
+ if (other.prev_ > prev_)
25
+ prev_ = other.prev_;
26
+ return static_cast<double>(hdr_add(histogram_.get(), other.histogram_.get()));
27
+ }
28
+
29
+ size_t Histogram::Count() const {
30
+ Mutex::ScopedLock lock(mutex_);
31
+ return count_;
32
+ }
33
+
34
+ int64_t Histogram::Min() const {
35
+ Mutex::ScopedLock lock(mutex_);
36
+ return hdr_min(histogram_.get());
37
+ }
38
+
39
+ int64_t Histogram::Max() const {
40
+ Mutex::ScopedLock lock(mutex_);
41
+ return hdr_max(histogram_.get());
42
+ }
43
+
44
+ double Histogram::Mean() const {
45
+ Mutex::ScopedLock lock(mutex_);
46
+ return hdr_mean(histogram_.get());
47
+ }
48
+
49
+ double Histogram::Stddev() const {
50
+ Mutex::ScopedLock lock(mutex_);
51
+ return hdr_stddev(histogram_.get());
52
+ }
53
+
54
+ int64_t Histogram::Percentile(double percentile) const {
55
+ Mutex::ScopedLock lock(mutex_);
56
+ CHECK_GT(percentile, 0);
57
+ CHECK_LE(percentile, 100);
58
+ return hdr_value_at_percentile(histogram_.get(), percentile);
59
+ }
60
+
61
+ template <typename Iterator>
62
+ void Histogram::Percentiles(Iterator&& fn) {
63
+ Mutex::ScopedLock lock(mutex_);
64
+ hdr_iter iter;
65
+ hdr_iter_percentile_init(&iter, histogram_.get(), 1);
66
+ while (hdr_iter_next(&iter)) {
67
+ double key = iter.specifics.percentiles.percentile;
68
+ fn(key, iter.value);
69
+ }
70
+ }
71
+
72
+ bool Histogram::Record(int64_t value) {
73
+ Mutex::ScopedLock lock(mutex_);
74
+ bool recorded = hdr_record_value(histogram_.get(), value);
75
+ if (!recorded)
76
+ exceeds_++;
77
+ else
78
+ count_++;
79
+ return recorded;
80
+ }
81
+
82
+ uint64_t Histogram::RecordDelta() {
83
+ Mutex::ScopedLock lock(mutex_);
84
+ uint64_t time = uv_hrtime();
85
+ int64_t delta = 0;
86
+ if (prev_ > 0) {
87
+ CHECK_GE(time, prev_);
88
+ delta = time - prev_;
89
+ if (hdr_record_value(histogram_.get(), delta))
90
+ count_++;
91
+ else
92
+ exceeds_++;
93
+ }
94
+ prev_ = time;
95
+ return delta;
96
+ }
97
+
98
+ size_t Histogram::GetMemorySize() const {
99
+ Mutex::ScopedLock lock(mutex_);
100
+ return hdr_get_memory_size(histogram_.get());
101
+ }
102
+
103
+ } // namespace node
104
+
105
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
106
+
107
+ #endif // SRC_HISTOGRAM_INL_H_
@@ -0,0 +1,279 @@
1
+ #ifndef SRC_HISTOGRAM_H_
2
+ #define SRC_HISTOGRAM_H_
3
+
4
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
+
6
+ #include <hdr/hdr_histogram.h>
7
+ #include "base_object.h"
8
+ #include "memory_tracker.h"
9
+ #include "node_messaging.h"
10
+ #include "util.h"
11
+ #include "uv.h"
12
+ #include "v8.h"
13
+
14
+ #include <functional>
15
+ #include <limits>
16
+ #include <map>
17
+ #include <string>
18
+
19
+ namespace node {
20
+
21
+ class ExternalReferenceRegistry;
22
+
23
+ constexpr int kDefaultHistogramFigures = 3;
24
+
25
+ class Histogram : public MemoryRetainer {
26
+ public:
27
+ struct Options {
28
+ int64_t lowest = 1;
29
+ int64_t highest = std::numeric_limits<int64_t>::max();
30
+ int figures = kDefaultHistogramFigures;
31
+ };
32
+
33
+ explicit Histogram(const Options& options);
34
+ virtual ~Histogram() = default;
35
+
36
+ inline bool Record(int64_t value);
37
+ inline void Reset();
38
+ inline int64_t Min() const;
39
+ inline int64_t Max() const;
40
+ inline double Mean() const;
41
+ inline double Stddev() const;
42
+ inline int64_t Percentile(double percentile) const;
43
+ inline size_t Exceeds() const { return exceeds_; }
44
+ inline size_t Count() const;
45
+
46
+ inline uint64_t RecordDelta();
47
+
48
+ inline double Add(const Histogram& other);
49
+
50
+ // Iterator is a function type that takes two doubles as argument, one for
51
+ // percentile and one for the value at that percentile.
52
+ template <typename Iterator>
53
+ inline void Percentiles(Iterator&& fn);
54
+
55
+ inline size_t GetMemorySize() const;
56
+
57
+ void MemoryInfo(MemoryTracker* tracker) const override;
58
+ SET_MEMORY_INFO_NAME(Histogram)
59
+ SET_SELF_SIZE(Histogram)
60
+
61
+ private:
62
+ using HistogramPointer = DeleteFnPtr<hdr_histogram, hdr_close>;
63
+ HistogramPointer histogram_;
64
+ uint64_t prev_ = 0;
65
+ size_t exceeds_ = 0;
66
+ size_t count_ = 0;
67
+ Mutex mutex_;
68
+ };
69
+
70
+ class HistogramImpl {
71
+ public:
72
+ enum InternalFields {
73
+ kSlot = BaseObject::kSlot,
74
+ kImplField = BaseObject::kInternalFieldCount,
75
+ kInternalFieldCount
76
+ };
77
+
78
+ explicit HistogramImpl(
79
+ const Histogram::Options& options = Histogram::Options {});
80
+ explicit HistogramImpl(std::shared_ptr<Histogram> histogram);
81
+
82
+ Histogram* operator->() { return histogram_.get(); }
83
+
84
+ const std::shared_ptr<Histogram>& histogram() const { return histogram_; }
85
+
86
+ static void DoReset(const v8::FunctionCallbackInfo<v8::Value>& args);
87
+ static void GetCountBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
88
+ static void GetMinBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
89
+ static void GetMaxBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
90
+ static void GetExceedsBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
91
+ static void GetCount(const v8::FunctionCallbackInfo<v8::Value>& args);
92
+ static void GetMin(const v8::FunctionCallbackInfo<v8::Value>& args);
93
+ static void GetMax(const v8::FunctionCallbackInfo<v8::Value>& args);
94
+ static void GetMean(const v8::FunctionCallbackInfo<v8::Value>& args);
95
+ static void GetExceeds(const v8::FunctionCallbackInfo<v8::Value>& args);
96
+ static void GetStddev(const v8::FunctionCallbackInfo<v8::Value>& args);
97
+ static void GetPercentile(const v8::FunctionCallbackInfo<v8::Value>& args);
98
+ static void GetPercentileBigInt(
99
+ const v8::FunctionCallbackInfo<v8::Value>& args);
100
+ static void GetPercentiles(const v8::FunctionCallbackInfo<v8::Value>& args);
101
+ static void GetPercentilesBigInt(
102
+ const v8::FunctionCallbackInfo<v8::Value>& args);
103
+
104
+ static void FastReset(v8::Local<v8::Value> unused,
105
+ v8::Local<v8::Value> receiver);
106
+ static double FastGetCount(v8::Local<v8::Value> unused,
107
+ v8::Local<v8::Value> receiver);
108
+ static double FastGetMin(v8::Local<v8::Value> unused,
109
+ v8::Local<v8::Value> receiver);
110
+ static double FastGetMax(v8::Local<v8::Value> unused,
111
+ v8::Local<v8::Value> receiver);
112
+ static double FastGetMean(v8::Local<v8::Value> unused,
113
+ v8::Local<v8::Value> receiver);
114
+ static double FastGetExceeds(v8::Local<v8::Value> unused,
115
+ v8::Local<v8::Value> receiver);
116
+ static double FastGetStddev(v8::Local<v8::Value> unused,
117
+ v8::Local<v8::Value> receiver);
118
+ static double FastGetPercentile(v8::Local<v8::Value> unused,
119
+ v8::Local<v8::Value> receiver,
120
+ const double percentile);
121
+
122
+ static void AddMethods(v8::Isolate* isolate,
123
+ v8::Local<v8::FunctionTemplate> tmpl);
124
+
125
+ static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
126
+
127
+ static HistogramImpl* FromJSObject(v8::Local<v8::Value> value);
128
+
129
+ private:
130
+ std::shared_ptr<Histogram> histogram_;
131
+
132
+ static v8::CFunction fast_reset_;
133
+ static v8::CFunction fast_get_count_;
134
+ static v8::CFunction fast_get_min_;
135
+ static v8::CFunction fast_get_max_;
136
+ static v8::CFunction fast_get_mean_;
137
+ static v8::CFunction fast_get_exceeds_;
138
+ static v8::CFunction fast_get_stddev_;
139
+ static v8::CFunction fast_get_percentile_;
140
+ };
141
+
142
+ class HistogramBase final : public BaseObject, public HistogramImpl {
143
+ public:
144
+ static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
145
+ IsolateData* isolate_data);
146
+ static void Initialize(IsolateData* isolate_data,
147
+ v8::Local<v8::ObjectTemplate> target);
148
+ static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
149
+
150
+ static BaseObjectPtr<HistogramBase> Create(
151
+ Environment* env,
152
+ const Histogram::Options& options = Histogram::Options {});
153
+
154
+ static BaseObjectPtr<HistogramBase> Create(
155
+ Environment* env,
156
+ std::shared_ptr<Histogram> histogram);
157
+
158
+ static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
159
+
160
+ void MemoryInfo(MemoryTracker* tracker) const override;
161
+ SET_MEMORY_INFO_NAME(HistogramBase)
162
+ SET_SELF_SIZE(HistogramBase)
163
+
164
+ static void Record(const v8::FunctionCallbackInfo<v8::Value>& args);
165
+ static void RecordDelta(const v8::FunctionCallbackInfo<v8::Value>& args);
166
+ static void Add(const v8::FunctionCallbackInfo<v8::Value>& args);
167
+
168
+ static void FastRecord(
169
+ v8::Local<v8::Value> unused,
170
+ v8::Local<v8::Value> receiver,
171
+ const int64_t value,
172
+ v8::FastApiCallbackOptions& options); // NOLINT(runtime/references)
173
+ static void FastRecordDelta(v8::Local<v8::Value> unused,
174
+ v8::Local<v8::Value> receiver);
175
+
176
+ HistogramBase(
177
+ Environment* env,
178
+ v8::Local<v8::Object> wrap,
179
+ const Histogram::Options& options = Histogram::Options {});
180
+
181
+ HistogramBase(
182
+ Environment* env,
183
+ v8::Local<v8::Object> wrap,
184
+ std::shared_ptr<Histogram> histogram);
185
+
186
+ BaseObject::TransferMode GetTransferMode() const override {
187
+ return TransferMode::kCloneable;
188
+ }
189
+ std::unique_ptr<worker::TransferData> CloneForMessaging() const override;
190
+
191
+ class HistogramTransferData : public worker::TransferData {
192
+ public:
193
+ explicit HistogramTransferData(const HistogramBase* histogram)
194
+ : histogram_(histogram->histogram()) {}
195
+
196
+ explicit HistogramTransferData(std::shared_ptr<Histogram> histogram)
197
+ : histogram_(std::move(histogram)) {}
198
+
199
+ BaseObjectPtr<BaseObject> Deserialize(
200
+ Environment* env,
201
+ v8::Local<v8::Context> context,
202
+ std::unique_ptr<worker::TransferData> self) override;
203
+
204
+ void MemoryInfo(MemoryTracker* tracker) const override;
205
+ SET_MEMORY_INFO_NAME(HistogramTransferData)
206
+ SET_SELF_SIZE(HistogramTransferData)
207
+
208
+ private:
209
+ std::shared_ptr<Histogram> histogram_;
210
+ };
211
+
212
+ private:
213
+ static v8::CFunction fast_record_;
214
+ static v8::CFunction fast_record_delta_;
215
+ };
216
+
217
+ class IntervalHistogram final : public HandleWrap, public HistogramImpl {
218
+ public:
219
+ enum class StartFlags {
220
+ NONE,
221
+ RESET
222
+ };
223
+
224
+ static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
225
+
226
+ static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
227
+ Environment* env);
228
+
229
+ static BaseObjectPtr<IntervalHistogram> Create(
230
+ Environment* env,
231
+ int32_t interval,
232
+ std::function<void(Histogram&)> on_interval,
233
+ const Histogram::Options& options);
234
+
235
+ IntervalHistogram(
236
+ Environment* env,
237
+ v8::Local<v8::Object> wrap,
238
+ AsyncWrap::ProviderType type,
239
+ int32_t interval,
240
+ std::function<void(Histogram&)> on_interval,
241
+ const Histogram::Options& options = Histogram::Options {});
242
+
243
+ static void Start(const v8::FunctionCallbackInfo<v8::Value>& args);
244
+ static void Stop(const v8::FunctionCallbackInfo<v8::Value>& args);
245
+
246
+ static void FastStart(v8::Local<v8::Value> unused,
247
+ v8::Local<v8::Value> receiver,
248
+ bool reset);
249
+ static void FastStop(v8::Local<v8::Value> unused,
250
+ v8::Local<v8::Value> receiver);
251
+
252
+ BaseObject::TransferMode GetTransferMode() const override {
253
+ return TransferMode::kCloneable;
254
+ }
255
+ std::unique_ptr<worker::TransferData> CloneForMessaging() const override;
256
+
257
+ void MemoryInfo(MemoryTracker* tracker) const override;
258
+ SET_MEMORY_INFO_NAME(IntervalHistogram)
259
+ SET_SELF_SIZE(IntervalHistogram)
260
+
261
+ private:
262
+ static void TimerCB(uv_timer_t* handle);
263
+ void OnStart(StartFlags flags = StartFlags::RESET);
264
+ void OnStop();
265
+
266
+ bool enabled_ = false;
267
+ int32_t interval_ = 0;
268
+ std::function<void(Histogram&)> on_interval_;
269
+ uv_timer_t timer_;
270
+
271
+ static v8::CFunction fast_start_;
272
+ static v8::CFunction fast_stop_;
273
+ };
274
+
275
+ } // namespace node
276
+
277
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
278
+
279
+ #endif // SRC_HISTOGRAM_H_
@@ -0,0 +1,30 @@
1
+ #ifndef SRC_INSPECTOR_IO_AGENT_H_
2
+ #define SRC_INSPECTOR_IO_AGENT_H_
3
+
4
+ #include <memory>
5
+ #include "inspector/network_resource_manager.h"
6
+ #include "node/inspector/protocol/IO.h"
7
+
8
+ namespace node::inspector::protocol {
9
+
10
+ class IoAgent : public IO::Backend {
11
+ public:
12
+ explicit IoAgent(
13
+ std::shared_ptr<NetworkResourceManager> network_resource_manager)
14
+ : network_resource_manager_(std::move(network_resource_manager)) {}
15
+ void Wire(UberDispatcher* dispatcher);
16
+ DispatchResponse read(const String& in_handle,
17
+ std::optional<int> in_offset,
18
+ std::optional<int> in_size,
19
+ String* out_data,
20
+ bool* out_eof) override;
21
+ DispatchResponse close(const String& in_handle) override;
22
+
23
+ private:
24
+ std::shared_ptr<IO::Frontend> frontend_;
25
+ std::unordered_map<std::string, int> offset_map_ =
26
+ {}; // Maps stream_id to offset
27
+ std::shared_ptr<NetworkResourceManager> network_resource_manager_;
28
+ };
29
+ } // namespace node::inspector::protocol
30
+ #endif // SRC_INSPECTOR_IO_AGENT_H_
@@ -0,0 +1,116 @@
1
+ #ifndef SRC_INSPECTOR_MAIN_THREAD_INTERFACE_H_
2
+ #define SRC_INSPECTOR_MAIN_THREAD_INTERFACE_H_
3
+
4
+ #if !HAVE_INSPECTOR
5
+ #error("This header can only be used when inspector is enabled")
6
+ #endif
7
+
8
+ #include "inspector_agent.h"
9
+ #include "node_mutex.h"
10
+
11
+ #include <atomic>
12
+ #include <deque>
13
+ #include <memory>
14
+ #include <unordered_map>
15
+
16
+ namespace v8_inspector {
17
+ class StringBuffer;
18
+ class StringView;
19
+ } // namespace v8_inspector
20
+
21
+ namespace node {
22
+ namespace inspector {
23
+ class MainThreadInterface;
24
+
25
+ class Request {
26
+ public:
27
+ virtual void Call(MainThreadInterface*) = 0;
28
+ virtual ~Request() = default;
29
+ };
30
+
31
+ class Deletable {
32
+ public:
33
+ virtual ~Deletable() = default;
34
+ };
35
+
36
+ std::unique_ptr<v8_inspector::StringBuffer> Utf8ToStringView(
37
+ const std::string_view message);
38
+
39
+ using MessageQueue = std::deque<std::unique_ptr<Request>>;
40
+
41
+ class MainThreadHandle : public std::enable_shared_from_this<MainThreadHandle> {
42
+ public:
43
+ explicit MainThreadHandle(MainThreadInterface* main_thread)
44
+ : main_thread_(main_thread) {
45
+ }
46
+ ~MainThreadHandle() {
47
+ Mutex::ScopedLock scoped_lock(block_lock_);
48
+ CHECK_NULL(main_thread_); // main_thread_ should have called Reset
49
+ }
50
+ std::unique_ptr<InspectorSession> Connect(
51
+ std::unique_ptr<InspectorSessionDelegate> delegate,
52
+ bool prevent_shutdown);
53
+ int newObjectId() {
54
+ return ++next_object_id_;
55
+ }
56
+ bool Post(std::unique_ptr<Request> request);
57
+ std::unique_ptr<InspectorSessionDelegate> MakeDelegateThreadSafe(
58
+ std::unique_ptr<InspectorSessionDelegate> delegate);
59
+ bool Expired();
60
+ void SetTargetSessionId(int target_session_id) {
61
+ target_session_id_ = target_session_id;
62
+ }
63
+ std::optional<int> GetTargetSessionId() { return target_session_id_; }
64
+
65
+ private:
66
+ void Reset();
67
+
68
+ MainThreadInterface* main_thread_;
69
+ Mutex block_lock_;
70
+ int next_session_id_ = 0;
71
+ std::atomic_int next_object_id_ = {1};
72
+ std::optional<int> target_session_id_ = std::nullopt;
73
+
74
+ friend class MainThreadInterface;
75
+ };
76
+
77
+ class MainThreadInterface :
78
+ public std::enable_shared_from_this<MainThreadInterface> {
79
+ public:
80
+ explicit MainThreadInterface(Agent* agent);
81
+ ~MainThreadInterface();
82
+
83
+ void DispatchMessages();
84
+ void Post(std::unique_ptr<Request> request);
85
+ bool WaitForFrontendEvent();
86
+ void StopWaitingForFrontendEvent();
87
+ std::shared_ptr<MainThreadHandle> GetHandle();
88
+ Agent* inspector_agent() {
89
+ return agent_;
90
+ }
91
+ void AddObject(int handle, std::unique_ptr<Deletable> object);
92
+ Deletable* GetObject(int id);
93
+ Deletable* GetObjectIfExists(int id);
94
+ void RemoveObject(int handle);
95
+
96
+ private:
97
+ MessageQueue requests_;
98
+ Mutex requests_lock_; // requests_ live across threads
99
+ // This queue is to maintain the order of the messages for the cases
100
+ // when we reenter the DispatchMessages function.
101
+ MessageQueue dispatching_message_queue_;
102
+ bool dispatching_messages_ = false;
103
+ // This flag indicates an internal request to exit the loop in
104
+ // WaitForFrontendEvent(). It's set to true by calling
105
+ // StopWaitingForFrontendEvent().
106
+ bool stop_waiting_for_frontend_event_requested_ = false;
107
+ ConditionVariable incoming_message_cond_;
108
+ // Used from any thread
109
+ Agent* const agent_;
110
+ std::shared_ptr<MainThreadHandle> handle_;
111
+ std::unordered_map<int, std::unique_ptr<Deletable>> managed_objects_;
112
+ };
113
+
114
+ } // namespace inspector
115
+ } // namespace node
116
+ #endif // SRC_INSPECTOR_MAIN_THREAD_INTERFACE_H_