@encharm/cws 4.5.2 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/CLAUDE.md +81 -0
- package/README.md +10 -5
- package/dist/bindings/cws_darwin_arm64_node115.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node127.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node137.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node147.node +0 -0
- package/dist/bindings/cws_linux_arm64_node115.node +0 -0
- package/dist/bindings/cws_linux_arm64_node127.node +0 -0
- package/dist/bindings/cws_linux_arm64_node137.node +0 -0
- package/dist/bindings/cws_linux_arm64_node147.node +0 -0
- package/dist/bindings/cws_linux_x64_node115.node +0 -0
- package/dist/bindings/cws_linux_x64_node127.node +0 -0
- package/dist/bindings/cws_linux_x64_node137.node +0 -0
- package/dist/bindings/cws_linux_x64_node147.node +0 -0
- package/dist/bindings/cws_win32_x64_node115.node +0 -0
- package/dist/bindings/cws_win32_x64_node127.node +0 -0
- package/dist/bindings/cws_win32_x64_node137.node +0 -0
- package/dist/bindings/cws_win32_x64_node147.node +0 -0
- package/package.json +1 -1
- package/src/Addon.cpp +2 -1
- package/src/Addon.h +70 -14
- package/src/Hub.h +1 -0
- package/src/Networking.h +11 -0
- package/src/Socket.h +201 -6
- package/src/WebSocket.cpp +4 -1
- package/src/cSNode.cpp +2 -0
- package/src/cSNode.h +4 -0
- package/src/headers/24/tracing/agent.h +195 -0
- package/src/headers/24/tracing/trace_event.h +722 -0
- package/src/headers/26/acorn_version.h +6 -0
- package/src/headers/26/aliased_buffer-inl.h +264 -0
- package/src/headers/26/aliased_buffer.h +205 -0
- package/src/headers/26/aliased_struct-inl.h +143 -0
- package/src/headers/26/aliased_struct.h +248 -0
- package/src/headers/26/amaro_version.h +6 -0
- package/src/headers/26/async_context_frame.h +33 -0
- package/src/headers/26/async_wrap-inl.h +123 -0
- package/src/headers/26/async_wrap.h +254 -0
- package/src/headers/26/base_object-inl.h +333 -0
- package/src/headers/26/base_object.h +339 -0
- package/src/headers/26/base_object_types.h +76 -0
- package/src/headers/26/blob_serializer_deserializer-inl.h +385 -0
- package/src/headers/26/blob_serializer_deserializer.h +142 -0
- package/src/headers/26/builtin_info.h +57 -0
- package/src/headers/26/callback_queue-inl.h +97 -0
- package/src/headers/26/callback_queue.h +79 -0
- package/src/headers/26/cares_wrap.h +475 -0
- package/src/headers/26/cleanup_queue-inl.h +36 -0
- package/src/headers/26/cleanup_queue.h +79 -0
- package/src/headers/26/compile_cache.h +134 -0
- package/src/headers/26/connect_wrap.h +26 -0
- package/src/headers/26/connection_wrap.h +30 -0
- package/src/headers/26/cppgc_helpers-inl.h +69 -0
- package/src/headers/26/cppgc_helpers.h +162 -0
- package/src/headers/26/crypto/crypto_aes.h +107 -0
- package/src/headers/26/crypto/crypto_argon2.h +88 -0
- package/src/headers/26/crypto/crypto_bio.h +193 -0
- package/src/headers/26/crypto/crypto_chacha20_poly1305.h +62 -0
- package/src/headers/26/crypto/crypto_cipher.h +291 -0
- package/src/headers/26/crypto/crypto_common.h +48 -0
- package/src/headers/26/crypto/crypto_context.h +219 -0
- package/src/headers/26/crypto/crypto_dh.h +104 -0
- package/src/headers/26/crypto/crypto_dsa.h +50 -0
- package/src/headers/26/crypto/crypto_ec.h +102 -0
- package/src/headers/26/crypto/crypto_hash.h +157 -0
- package/src/headers/26/crypto/crypto_hkdf.h +62 -0
- package/src/headers/26/crypto/crypto_hmac.h +92 -0
- package/src/headers/26/crypto/crypto_kem.h +131 -0
- package/src/headers/26/crypto/crypto_keygen.h +382 -0
- package/src/headers/26/crypto/crypto_keys.h +366 -0
- package/src/headers/26/crypto/crypto_kmac.h +79 -0
- package/src/headers/26/crypto/crypto_pbkdf2.h +76 -0
- package/src/headers/26/crypto/crypto_pqc.h +39 -0
- package/src/headers/26/crypto/crypto_random.h +127 -0
- package/src/headers/26/crypto/crypto_rsa.h +108 -0
- package/src/headers/26/crypto/crypto_scrypt.h +85 -0
- package/src/headers/26/crypto/crypto_sig.h +159 -0
- package/src/headers/26/crypto/crypto_spkac.h +21 -0
- package/src/headers/26/crypto/crypto_timing.h +20 -0
- package/src/headers/26/crypto/crypto_tls.h +342 -0
- package/src/headers/26/crypto/crypto_turboshake.h +105 -0
- package/src/headers/26/crypto/crypto_util.h +775 -0
- package/src/headers/26/crypto/crypto_x509.h +140 -0
- package/src/headers/26/dataqueue/queue.h +311 -0
- package/src/headers/26/debug_utils-inl.h +291 -0
- package/src/headers/26/debug_utils.h +200 -0
- package/src/headers/26/diagnosticfilename-inl.h +33 -0
- package/src/headers/26/embedded_data.h +17 -0
- package/src/headers/26/encoding_binding.h +59 -0
- package/src/headers/26/env-inl.h +956 -0
- package/src/headers/26/env.h +1294 -0
- package/src/headers/26/env_properties.h +562 -0
- package/src/headers/26/ffi/data.h +30 -0
- package/src/headers/26/ffi/fast.h +96 -0
- package/src/headers/26/ffi/jit_memory.h +26 -0
- package/src/headers/26/ffi/types.h +99 -0
- package/src/headers/26/handle_wrap.h +123 -0
- package/src/headers/26/histogram-inl.h +211 -0
- package/src/headers/26/histogram.h +474 -0
- package/src/headers/26/inspector/dom_storage_agent.h +68 -0
- package/src/headers/26/inspector/inspector_object_utils.h +38 -0
- package/src/headers/26/inspector/io_agent.h +30 -0
- package/src/headers/26/inspector/main_thread_interface.h +116 -0
- package/src/headers/26/inspector/network_agent.h +110 -0
- package/src/headers/26/inspector/network_inspector.h +45 -0
- package/src/headers/26/inspector/network_requests_buffer.h +195 -0
- package/src/headers/26/inspector/network_resource_manager.h +29 -0
- package/src/headers/26/inspector/node_json.h +24 -0
- package/src/headers/26/inspector/node_string.h +101 -0
- package/src/headers/26/inspector/notification_emitter.h +38 -0
- package/src/headers/26/inspector/protocol_helper.h +27 -0
- package/src/headers/26/inspector/runtime_agent.h +41 -0
- package/src/headers/26/inspector/storage_agent.h +33 -0
- package/src/headers/26/inspector/target_agent.h +59 -0
- package/src/headers/26/inspector/target_manager.h +70 -0
- package/src/headers/26/inspector/tracing_agent.h +43 -0
- package/src/headers/26/inspector/worker_agent.h +40 -0
- package/src/headers/26/inspector/worker_inspector.h +124 -0
- package/src/headers/26/inspector_agent.h +168 -0
- package/src/headers/26/inspector_io.h +78 -0
- package/src/headers/26/inspector_profiler.h +149 -0
- package/src/headers/26/inspector_socket.h +60 -0
- package/src/headers/26/inspector_socket_server.h +110 -0
- package/src/headers/26/js_native_api.h +634 -0
- package/src/headers/26/js_native_api_types.h +244 -0
- package/src/headers/26/js_native_api_v8.h +485 -0
- package/src/headers/26/js_native_api_v8_internals.h +45 -0
- package/src/headers/26/js_stream.h +57 -0
- package/src/headers/26/json_utils.h +172 -0
- package/src/headers/26/large_pages/node_large_page.h +34 -0
- package/src/headers/26/lru_cache-inl.h +69 -0
- package/src/headers/26/memory_tracker-inl.h +461 -0
- package/src/headers/26/memory_tracker.h +341 -0
- package/src/headers/26/module_wrap.h +231 -0
- package/src/headers/26/ncrypto.h +2008 -0
- package/src/headers/26/node.h +1693 -0
- package/src/headers/26/node_api.h +265 -0
- package/src/headers/26/node_api_internals.h +48 -0
- package/src/headers/26/node_api_types.h +58 -0
- package/src/headers/26/node_binding.h +170 -0
- package/src/headers/26/node_blob.h +160 -0
- package/src/headers/26/node_bob-inl.h +36 -0
- package/src/headers/26/node_bob.h +107 -0
- package/src/headers/26/node_buffer.h +92 -0
- package/src/headers/26/node_builtins.h +239 -0
- package/src/headers/26/node_concepts.h +46 -0
- package/src/headers/26/node_config_file.h +77 -0
- package/src/headers/26/node_constants.h +82 -0
- package/src/headers/26/node_context_data.h +171 -0
- package/src/headers/26/node_contextify.h +261 -0
- package/src/headers/26/node_crypto.h +66 -0
- package/src/headers/26/node_debug.h +30 -0
- package/src/headers/26/node_diagnostics_channel.h +121 -0
- package/src/headers/26/node_dir.h +52 -0
- package/src/headers/26/node_dotenv.h +45 -0
- package/src/headers/26/node_errors.h +378 -0
- package/src/headers/26/node_exit_code.h +54 -0
- package/src/headers/26/node_external_reference.h +171 -0
- package/src/headers/26/node_ffi.h +212 -0
- package/src/headers/26/node_file-inl.h +421 -0
- package/src/headers/26/node_file.h +561 -0
- package/src/headers/26/node_file_utils.h +39 -0
- package/src/headers/26/node_hash.h +212 -0
- package/src/headers/26/node_http2.h +1202 -0
- package/src/headers/26/node_http2_state.h +159 -0
- package/src/headers/26/node_http_common-inl.h +199 -0
- package/src/headers/26/node_http_common.h +535 -0
- package/src/headers/26/node_i18n.h +132 -0
- package/src/headers/26/node_internals.h +485 -0
- package/src/headers/26/node_locks.h +184 -0
- package/src/headers/26/node_main_instance.h +67 -0
- package/src/headers/26/node_mem-inl.h +113 -0
- package/src/headers/26/node_mem.h +45 -0
- package/src/headers/26/node_messaging.h +389 -0
- package/src/headers/26/node_metadata.h +172 -0
- package/src/headers/26/node_modules.h +102 -0
- package/src/headers/26/node_mutex.h +323 -0
- package/src/headers/26/node_object_wrap.h +145 -0
- package/src/headers/26/node_options-inl.h +524 -0
- package/src/headers/26/node_options.h +710 -0
- package/src/headers/26/node_perf.h +167 -0
- package/src/headers/26/node_perf_common.h +103 -0
- package/src/headers/26/node_platform.h +290 -0
- package/src/headers/26/node_process-inl.h +26 -0
- package/src/headers/26/node_process.h +112 -0
- package/src/headers/26/node_profiling.h +38 -0
- package/src/headers/26/node_realm-inl.h +156 -0
- package/src/headers/26/node_realm.h +236 -0
- package/src/headers/26/node_report.h +43 -0
- package/src/headers/26/node_revert.h +82 -0
- package/src/headers/26/node_root_certs.h +2937 -0
- package/src/headers/26/node_sea.h +101 -0
- package/src/headers/26/node_shadow_realm.h +46 -0
- package/src/headers/26/node_snapshot_builder.h +57 -0
- package/src/headers/26/node_snapshotable.h +167 -0
- package/src/headers/26/node_sockaddr-inl.h +248 -0
- package/src/headers/26/node_sockaddr.h +459 -0
- package/src/headers/26/node_sqlite.h +607 -0
- package/src/headers/26/node_stat_watcher.h +73 -0
- package/src/headers/26/node_task_runner.h +92 -0
- package/src/headers/26/node_threadsafe_cow-inl.h +54 -0
- package/src/headers/26/node_threadsafe_cow.h +105 -0
- package/src/headers/26/node_union_bytes.h +81 -0
- package/src/headers/26/node_url.h +101 -0
- package/src/headers/26/node_url_pattern.h +118 -0
- package/src/headers/26/node_v8.h +78 -0
- package/src/headers/26/node_v8_embedder.h +26 -0
- package/src/headers/26/node_v8_platform-inl.h +96 -0
- package/src/headers/26/node_version.h +116 -0
- package/src/headers/26/node_wasi.h +184 -0
- package/src/headers/26/node_wasm_web_api.h +55 -0
- package/src/headers/26/node_watchdog.h +164 -0
- package/src/headers/26/node_webstorage.h +62 -0
- package/src/headers/26/node_worker.h +162 -0
- package/src/headers/26/path.h +36 -0
- package/src/headers/26/permission/boolean_permission.h +50 -0
- package/src/headers/26/permission/fs_permission.h +192 -0
- package/src/headers/26/permission/permission.h +155 -0
- package/src/headers/26/permission/permission_base.h +79 -0
- package/src/headers/26/pipe_wrap.h +80 -0
- package/src/headers/26/quic/application.h +279 -0
- package/src/headers/26/quic/arena.h +373 -0
- package/src/headers/26/quic/bindingdata.h +440 -0
- package/src/headers/26/quic/cid.h +127 -0
- package/src/headers/26/quic/data.h +358 -0
- package/src/headers/26/quic/defs.h +417 -0
- package/src/headers/26/quic/endpoint.h +519 -0
- package/src/headers/26/quic/guard.h +5 -0
- package/src/headers/26/quic/http3.h +25 -0
- package/src/headers/26/quic/packet.h +166 -0
- package/src/headers/26/quic/preferredaddress.h +72 -0
- package/src/headers/26/quic/session.h +770 -0
- package/src/headers/26/quic/session_manager.h +107 -0
- package/src/headers/26/quic/sessionticket.h +110 -0
- package/src/headers/26/quic/streams.h +518 -0
- package/src/headers/26/quic/tlscontext.h +353 -0
- package/src/headers/26/quic/tokens.h +263 -0
- package/src/headers/26/quic/transportparams.h +184 -0
- package/src/headers/26/req_wrap-inl.h +175 -0
- package/src/headers/26/req_wrap.h +79 -0
- package/src/headers/26/spawn_sync.h +243 -0
- package/src/headers/26/stream_base-inl.h +170 -0
- package/src/headers/26/stream_base.h +487 -0
- package/src/headers/26/stream_pipe.h +76 -0
- package/src/headers/26/stream_wrap.h +137 -0
- package/src/headers/26/string_bytes.h +114 -0
- package/src/headers/26/string_decoder-inl.h +31 -0
- package/src/headers/26/string_decoder.h +49 -0
- package/src/headers/26/tcp_wrap.h +138 -0
- package/src/headers/26/threadpoolwork-inl.h +70 -0
- package/src/headers/26/timer_wrap-inl.h +32 -0
- package/src/headers/26/timer_wrap.h +87 -0
- package/src/headers/26/timers.h +70 -0
- package/src/headers/26/tracing/agent.h +125 -0
- package/src/headers/26/tracing/agent_legacy.h +146 -0
- package/src/headers/26/tracing/agent_perfetto.h +145 -0
- package/src/headers/26/tracing/node_trace_buffer.h +91 -0
- package/src/headers/26/tracing/node_trace_writer.h +79 -0
- package/src/headers/26/tracing/trace_event.h +27 -0
- package/src/headers/26/tracing/trace_event_helper.h +40 -0
- package/src/headers/26/tracing/trace_event_legacy.h +1113 -0
- package/src/headers/26/tracing/trace_event_legacy_inl.h +711 -0
- package/src/headers/26/tracing/trace_event_perfetto.h +47 -0
- package/src/headers/26/tracing/traced_value.h +167 -0
- package/src/headers/26/tty_wrap.h +65 -0
- package/src/headers/26/udp_wrap.h +231 -0
- package/src/headers/26/undici_version.h +6 -0
- package/src/headers/26/util-inl.h +788 -0
- package/src/headers/26/util.h +1207 -0
- package/src/headers/26/v8-cpp-heap-external.h +56 -0
- package/src/headers/26/v8-external-memory-accounter.h +60 -0
- package/src/headers/26/v8-fast-api-calls.h +784 -0
- package/src/headers/26/v8-inspector-protocol.h +13 -0
- package/src/headers/26/v8-inspector.h +458 -0
- package/src/headers/26/v8-metrics.h +273 -0
- package/src/headers/26/v8-trace-categories.h +28 -0
- package/src/headers/26/v8-unwinder-state.h +30 -0
- package/src/headers/26/v8-util.h +549 -0
- package/src/headers/26/v8-value-serializer-version.h +24 -0
- package/src/headers/26/v8-version-string.h +38 -0
- package/src/headers/26/v8-wasm-trap-handler-posix.h +31 -0
- package/src/headers/26/v8-wasm-trap-handler-win.h +28 -0
- package/src/headers/26/zlib_version.h +6 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
4
|
+
|
|
5
|
+
#include "node_concepts.h"
|
|
6
|
+
#include "v8-profiler.h"
|
|
7
|
+
|
|
8
|
+
#include <uv.h>
|
|
9
|
+
|
|
10
|
+
#include <limits>
|
|
11
|
+
#include <queue>
|
|
12
|
+
#include <stack>
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <unordered_map>
|
|
15
|
+
|
|
16
|
+
namespace v8 {
|
|
17
|
+
class BackingStore;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
namespace node {
|
|
21
|
+
|
|
22
|
+
class CppgcMixin;
|
|
23
|
+
|
|
24
|
+
template <typename T>
|
|
25
|
+
struct MallocedBuffer;
|
|
26
|
+
|
|
27
|
+
// Set the node name of a MemoryRetainer to klass
|
|
28
|
+
#define SET_MEMORY_INFO_NAME(Klass) \
|
|
29
|
+
inline const char* MemoryInfoName() const override { return #Klass; }
|
|
30
|
+
|
|
31
|
+
// Set the self size of a MemoryRetainer to the stack-allocated size of a
|
|
32
|
+
// certain class
|
|
33
|
+
#define SET_SELF_SIZE(Klass) \
|
|
34
|
+
inline size_t SelfSize() const override { return sizeof(Klass); }
|
|
35
|
+
|
|
36
|
+
// Used when there is no additional fields to track
|
|
37
|
+
#define SET_NO_MEMORY_INFO() \
|
|
38
|
+
inline void MemoryInfo(node::MemoryTracker* tracker) const override {}
|
|
39
|
+
|
|
40
|
+
class MemoryTracker;
|
|
41
|
+
class MemoryRetainerNode;
|
|
42
|
+
template <typename T, bool kIsWeak>
|
|
43
|
+
class BaseObjectPtrImpl;
|
|
44
|
+
|
|
45
|
+
namespace crypto {
|
|
46
|
+
class NodeBIO;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class CleanupHookCallback;
|
|
50
|
+
|
|
51
|
+
/* Example:
|
|
52
|
+
*
|
|
53
|
+
* class ExampleRetainer : public MemoryRetainer {
|
|
54
|
+
* public:
|
|
55
|
+
* // Or use SET_NO_MEMORY_INFO() when there is no additional fields
|
|
56
|
+
* // to track.
|
|
57
|
+
* void MemoryInfo(MemoryTracker* tracker) const override {
|
|
58
|
+
* // Node name and size comes from the MemoryInfoName and SelfSize of
|
|
59
|
+
* // AnotherRetainerClass
|
|
60
|
+
* tracker->TrackField("another_retainer", another_retainer_);
|
|
61
|
+
*
|
|
62
|
+
* // Add non_pointer_retainer as a separate node into the graph
|
|
63
|
+
* // and track its memory information recursively.
|
|
64
|
+
* // Note that we need to make sure its size is not accounted in
|
|
65
|
+
* // ExampleRetainer::SelfSize().
|
|
66
|
+
* tracker->TrackField("non_pointer_retainer", &non_pointer_retainer_);
|
|
67
|
+
*
|
|
68
|
+
* // Specify node name and size explicitly
|
|
69
|
+
* tracker->TrackFieldWithSize("internal_member",
|
|
70
|
+
* internal_member_.size(),
|
|
71
|
+
* "InternalClass");
|
|
72
|
+
* // Node name falls back to the edge name,
|
|
73
|
+
* // elements in the container appear as grandchildren nodes
|
|
74
|
+
* tracker->TrackField("vector", vector_);
|
|
75
|
+
* // Node name and size come from the JS object
|
|
76
|
+
* tracker->TrackField("target", target_);
|
|
77
|
+
* }
|
|
78
|
+
*
|
|
79
|
+
* // Or use SET_MEMORY_INFO_NAME(ExampleRetainer)
|
|
80
|
+
* const char* MemoryInfoName() const override {
|
|
81
|
+
* return "ExampleRetainer";
|
|
82
|
+
* }
|
|
83
|
+
*
|
|
84
|
+
* // Classes that only want to return its sizeof() value can use the
|
|
85
|
+
* // SET_SELF_SIZE(Class) macro instead.
|
|
86
|
+
* size_t SelfSize() const override {
|
|
87
|
+
* // We need to exclude the size of non_pointer_retainer so that
|
|
88
|
+
* // we can track it separately in ExampleRetainer::MemoryInfo().
|
|
89
|
+
* return sizeof(ExampleRetainer) - sizeof(NonPointerRetainerClass);
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* // Note: no need to implement these two methods when implementing
|
|
93
|
+
* // a BaseObject or an AsyncWrap class
|
|
94
|
+
* bool IsRootNode() const override { return !wrapped_.IsWeak(); }
|
|
95
|
+
* v8::Local<v8::Object> WrappedObject() const override {
|
|
96
|
+
* return node::PersistentToLocal::Default(wrapped_);
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* private:
|
|
100
|
+
* AnotherRetainerClass* another_retainer_;
|
|
101
|
+
* NonPointerRetainerClass non_pointer_retainer;
|
|
102
|
+
* InternalClass internal_member_;
|
|
103
|
+
* std::vector<uv_async_t> vector_;
|
|
104
|
+
* v8::Global<Object> target_;
|
|
105
|
+
*
|
|
106
|
+
* v8::Global<Object> wrapped_;
|
|
107
|
+
* }
|
|
108
|
+
*
|
|
109
|
+
* This creates the following graph:
|
|
110
|
+
* Node / ExampleRetainer
|
|
111
|
+
* |> another_retainer :: Node / AnotherRetainerClass
|
|
112
|
+
* |> internal_member :: Node / InternalClass
|
|
113
|
+
* |> vector :: Node / vector (elements will be grandchildren)
|
|
114
|
+
* |> [1] :: Node / uv_async_t (uv_async_t has predefined names)
|
|
115
|
+
* |> [2] :: Node / uv_async_t
|
|
116
|
+
* |> ...
|
|
117
|
+
* |> target :: TargetClass (JS class name of the target object)
|
|
118
|
+
* |> wrapped :: WrappedClass (JS class name of the wrapped object)
|
|
119
|
+
* |> wrapper :: Node / ExampleRetainer (back reference)
|
|
120
|
+
*/
|
|
121
|
+
class MemoryRetainer {
|
|
122
|
+
public:
|
|
123
|
+
virtual ~MemoryRetainer() = default;
|
|
124
|
+
|
|
125
|
+
// Subclasses should implement these methods to provide information
|
|
126
|
+
// for the V8 heap snapshot generator.
|
|
127
|
+
// The MemoryInfo() method is assumed to be called within a context
|
|
128
|
+
// where all the edges start from the node of the current retainer,
|
|
129
|
+
// and point to the nodes as specified by tracker->Track* calls.
|
|
130
|
+
virtual void MemoryInfo(MemoryTracker* tracker) const = 0;
|
|
131
|
+
virtual const char* MemoryInfoName() const = 0;
|
|
132
|
+
virtual size_t SelfSize() const = 0;
|
|
133
|
+
|
|
134
|
+
virtual v8::Local<v8::Object> WrappedObject() const {
|
|
135
|
+
return v8::Local<v8::Object>();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
virtual bool IsRootNode() const { return false; }
|
|
139
|
+
virtual bool IsCppgcWrapper() const { return false; }
|
|
140
|
+
virtual v8::EmbedderGraph::Node::Detachedness GetDetachedness() const {
|
|
141
|
+
return v8::EmbedderGraph::Node::Detachedness::kUnknown;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* MemoryRetainerTraits allows defining a custom memory info for a
|
|
147
|
+
* class that can not be modified to implement the MemoryRetainer interface.
|
|
148
|
+
*
|
|
149
|
+
* Example:
|
|
150
|
+
*
|
|
151
|
+
* template <>
|
|
152
|
+
* struct MemoryRetainerTraits<ExampleRetainer> {
|
|
153
|
+
* static void MemoryInfo(MemoryTracker* tracker,
|
|
154
|
+
* const ExampleRetainer& value) {
|
|
155
|
+
* tracker->TrackField("another_retainer", value.another_retainer_);
|
|
156
|
+
* }
|
|
157
|
+
* static const char* MemoryInfoName(const ExampleRetainer& value) {
|
|
158
|
+
* return "ExampleRetainer";
|
|
159
|
+
* }
|
|
160
|
+
* static size_t SelfSize(const ExampleRetainer& value) {
|
|
161
|
+
* return sizeof(value);
|
|
162
|
+
* }
|
|
163
|
+
* };
|
|
164
|
+
*
|
|
165
|
+
* This creates the following graph:
|
|
166
|
+
* Node / ExampleRetainer
|
|
167
|
+
* |> another_retainer :: Node / AnotherRetainerClass
|
|
168
|
+
*/
|
|
169
|
+
template <typename T, typename = void>
|
|
170
|
+
struct MemoryRetainerTraits {};
|
|
171
|
+
|
|
172
|
+
class MemoryTracker {
|
|
173
|
+
public:
|
|
174
|
+
// Used to specify node name and size explicitly
|
|
175
|
+
inline void TrackFieldWithSize(const char* edge_name,
|
|
176
|
+
size_t size,
|
|
177
|
+
const char* node_name = nullptr);
|
|
178
|
+
inline void TrackInlineFieldWithSize(const char* edge_name,
|
|
179
|
+
size_t size,
|
|
180
|
+
const char* node_name = nullptr);
|
|
181
|
+
|
|
182
|
+
// Shortcut to extract the underlying object out of the smart pointer
|
|
183
|
+
template <typename T, typename D>
|
|
184
|
+
inline void TrackField(const char* edge_name,
|
|
185
|
+
const std::unique_ptr<T, D>& value,
|
|
186
|
+
const char* node_name = nullptr);
|
|
187
|
+
|
|
188
|
+
template <typename T>
|
|
189
|
+
inline void TrackField(const char* edge_name,
|
|
190
|
+
const std::shared_ptr<T>& value,
|
|
191
|
+
const char* node_name = nullptr);
|
|
192
|
+
|
|
193
|
+
template <typename T, bool kIsWeak>
|
|
194
|
+
void TrackField(const char* edge_name,
|
|
195
|
+
const BaseObjectPtrImpl<T, kIsWeak>& value,
|
|
196
|
+
const char* node_name = nullptr);
|
|
197
|
+
|
|
198
|
+
// For containers, the elements will be graphed as grandchildren nodes
|
|
199
|
+
// if the container is not empty.
|
|
200
|
+
// By default, we assume the parent count the stack size of the container
|
|
201
|
+
// into its SelfSize so that will be subtracted from the parent size when we
|
|
202
|
+
// spin off a new node for the container.
|
|
203
|
+
// TODO(joyeecheung): use RTTI to retrieve the class name at runtime?
|
|
204
|
+
template <typename T, typename Iterator = typename T::const_iterator>
|
|
205
|
+
inline void TrackField(const char* edge_name,
|
|
206
|
+
const T& value,
|
|
207
|
+
const char* node_name = nullptr,
|
|
208
|
+
const char* element_name = nullptr,
|
|
209
|
+
bool subtract_from_self = true);
|
|
210
|
+
template <typename T>
|
|
211
|
+
inline void TrackField(const char* edge_name,
|
|
212
|
+
const std::queue<T>& value,
|
|
213
|
+
const char* node_name = nullptr,
|
|
214
|
+
const char* element_name = nullptr);
|
|
215
|
+
template <typename T, typename U>
|
|
216
|
+
inline void TrackField(const char* edge_name,
|
|
217
|
+
const std::pair<T, U>& value,
|
|
218
|
+
const char* node_name = nullptr);
|
|
219
|
+
|
|
220
|
+
// For the following types, node_name will be ignored and predefined names
|
|
221
|
+
// will be used instead. They are only in the signature for template
|
|
222
|
+
// expansion.
|
|
223
|
+
inline void TrackField(const char* edge_name,
|
|
224
|
+
const MemoryRetainer& value,
|
|
225
|
+
const char* node_name = nullptr);
|
|
226
|
+
inline void TrackField(const char* edge_name,
|
|
227
|
+
const MemoryRetainer* value,
|
|
228
|
+
const char* node_name = nullptr);
|
|
229
|
+
template <typename T>
|
|
230
|
+
inline void TrackField(const char* edge_name,
|
|
231
|
+
const std::basic_string<T>& value,
|
|
232
|
+
const char* node_name = nullptr);
|
|
233
|
+
template <NumericValue T>
|
|
234
|
+
inline void TrackField(const char* edge_name,
|
|
235
|
+
const T& value,
|
|
236
|
+
const char* node_name = nullptr);
|
|
237
|
+
template <typename T>
|
|
238
|
+
void TrackField(const char* edge_name,
|
|
239
|
+
const v8::Eternal<T>& value,
|
|
240
|
+
const char* node_name);
|
|
241
|
+
template <typename T>
|
|
242
|
+
inline void TrackField(const char* edge_name,
|
|
243
|
+
const v8::PersistentBase<T>& value,
|
|
244
|
+
const char* node_name = nullptr);
|
|
245
|
+
template <typename T>
|
|
246
|
+
inline void TrackField(const char* edge_name,
|
|
247
|
+
const v8::Local<T>& value,
|
|
248
|
+
const char* node_name = nullptr);
|
|
249
|
+
template <typename T>
|
|
250
|
+
inline void TrackField(const char* edge_name,
|
|
251
|
+
const MallocedBuffer<T>& value,
|
|
252
|
+
const char* node_name = nullptr);
|
|
253
|
+
inline void TrackField(const char* edge_name,
|
|
254
|
+
const v8::BackingStore* value,
|
|
255
|
+
const char* node_name = nullptr);
|
|
256
|
+
inline void TrackField(const char* edge_name,
|
|
257
|
+
const uv_buf_t& value,
|
|
258
|
+
const char* node_name = nullptr);
|
|
259
|
+
inline void TrackField(const char* edge_name,
|
|
260
|
+
const uv_timer_t& value,
|
|
261
|
+
const char* node_name = nullptr);
|
|
262
|
+
inline void TrackField(const char* edge_name,
|
|
263
|
+
const uv_async_t& value,
|
|
264
|
+
const char* node_name = nullptr);
|
|
265
|
+
inline void TrackInlineField(const char* edge_name,
|
|
266
|
+
const uv_async_t& value,
|
|
267
|
+
const char* node_name = nullptr);
|
|
268
|
+
|
|
269
|
+
// Put a memory container into the graph, create an edge from
|
|
270
|
+
// the current node if there is one on the stack.
|
|
271
|
+
inline void Track(const CppgcMixin* retainer,
|
|
272
|
+
const char* edge_name = nullptr);
|
|
273
|
+
inline void Track(const MemoryRetainer* retainer,
|
|
274
|
+
const char* edge_name = nullptr);
|
|
275
|
+
|
|
276
|
+
// Useful for parents that do not wish to perform manual
|
|
277
|
+
// adjustments to its `SelfSize()` when embedding retainer
|
|
278
|
+
// objects inline.
|
|
279
|
+
// Put a memory container into the graph, create an edge from
|
|
280
|
+
// the current node if there is one on the stack - there should
|
|
281
|
+
// be one, of the container object which the current field is part of.
|
|
282
|
+
// Reduce the size of memory from the container so as to avoid
|
|
283
|
+
// duplication in accounting.
|
|
284
|
+
inline void TrackInlineField(const MemoryRetainer* retainer,
|
|
285
|
+
const char* edge_name = nullptr);
|
|
286
|
+
|
|
287
|
+
// MemoryRetainerTraits implementation helpers.
|
|
288
|
+
template <typename T>
|
|
289
|
+
inline void TraitTrack(const T& retainer, const char* edge_name = nullptr);
|
|
290
|
+
template <typename T>
|
|
291
|
+
inline void TraitTrackInline(const T& retainer,
|
|
292
|
+
const char* edge_name = nullptr);
|
|
293
|
+
|
|
294
|
+
inline v8::EmbedderGraph* graph() { return graph_; }
|
|
295
|
+
inline v8::Isolate* isolate() { return isolate_; }
|
|
296
|
+
|
|
297
|
+
inline explicit MemoryTracker(v8::Isolate* isolate,
|
|
298
|
+
v8::EmbedderGraph* graph)
|
|
299
|
+
: isolate_(isolate), graph_(graph) {}
|
|
300
|
+
|
|
301
|
+
// Can be passed to Track() if it is not desirable
|
|
302
|
+
// to create a strong edge between nodes, i.e. when
|
|
303
|
+
// the node should be added to the graph and the
|
|
304
|
+
// parent node is "tracking" the target node but
|
|
305
|
+
// not directly keeping it alive.
|
|
306
|
+
static const char* const kWeakEdge;
|
|
307
|
+
|
|
308
|
+
private:
|
|
309
|
+
typedef std::unordered_map<const MemoryRetainer*, MemoryRetainerNode*>
|
|
310
|
+
NodeMap;
|
|
311
|
+
|
|
312
|
+
inline void AdjustCurrentNodeSize(int diff);
|
|
313
|
+
inline v8::EmbedderGraph::Node* CurrentNode() const;
|
|
314
|
+
inline MemoryRetainerNode* AddNode(const CppgcMixin* retainer,
|
|
315
|
+
const char* edge_name = nullptr);
|
|
316
|
+
inline MemoryRetainerNode* AddNode(const MemoryRetainer* retainer,
|
|
317
|
+
const char* edge_name = nullptr);
|
|
318
|
+
inline MemoryRetainerNode* PushNode(const CppgcMixin* retainer,
|
|
319
|
+
const char* edge_name = nullptr);
|
|
320
|
+
inline MemoryRetainerNode* PushNode(const MemoryRetainer* retainer,
|
|
321
|
+
const char* edge_name = nullptr);
|
|
322
|
+
inline MemoryRetainerNode* AddNode(const char* node_name,
|
|
323
|
+
size_t size,
|
|
324
|
+
const char* edge_name = nullptr);
|
|
325
|
+
inline MemoryRetainerNode* PushNode(const char* node_name,
|
|
326
|
+
size_t size,
|
|
327
|
+
const char* edge_name = nullptr);
|
|
328
|
+
inline void PopNode();
|
|
329
|
+
inline void AddEdge(v8::EmbedderGraph::Node* from,
|
|
330
|
+
v8::EmbedderGraph::Node* to,
|
|
331
|
+
const char* edge_name = nullptr);
|
|
332
|
+
|
|
333
|
+
v8::Isolate* isolate_;
|
|
334
|
+
v8::EmbedderGraph* graph_;
|
|
335
|
+
std::stack<MemoryRetainerNode*> node_stack_;
|
|
336
|
+
NodeMap seen_;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
} // namespace node
|
|
340
|
+
|
|
341
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
#ifndef SRC_MODULE_WRAP_H_
|
|
2
|
+
#define SRC_MODULE_WRAP_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include <optional>
|
|
7
|
+
#include <string>
|
|
8
|
+
#include <unordered_map>
|
|
9
|
+
#include <vector>
|
|
10
|
+
#include "base_object.h"
|
|
11
|
+
#include "v8-script.h"
|
|
12
|
+
|
|
13
|
+
namespace node {
|
|
14
|
+
|
|
15
|
+
class IsolateData;
|
|
16
|
+
class Environment;
|
|
17
|
+
class ExternalReferenceRegistry;
|
|
18
|
+
|
|
19
|
+
namespace contextify {
|
|
20
|
+
class ContextifyContext;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
namespace loader {
|
|
24
|
+
|
|
25
|
+
enum ScriptType : int {
|
|
26
|
+
kScript,
|
|
27
|
+
kModule,
|
|
28
|
+
kFunction,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
enum HostDefinedOptions : int {
|
|
32
|
+
kID = 8,
|
|
33
|
+
kLength = 9,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
enum ModulePhase : int {
|
|
37
|
+
kSourcePhase = 1,
|
|
38
|
+
kDeferPhase = 2,
|
|
39
|
+
kEvaluationPhase = 3,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* ModuleCacheKey is used to uniquely identify a module request
|
|
44
|
+
* in the module cache. It is a composition of the module specifier
|
|
45
|
+
* and the import attributes. ModuleImportPhase is not included
|
|
46
|
+
* in the key.
|
|
47
|
+
*/
|
|
48
|
+
struct ModuleCacheKey : public MemoryRetainer {
|
|
49
|
+
using ImportAttributeVector =
|
|
50
|
+
std::vector<std::pair<std::string, std::string>>;
|
|
51
|
+
|
|
52
|
+
std::string specifier;
|
|
53
|
+
ImportAttributeVector import_attributes;
|
|
54
|
+
// A hash of the specifier, and import attributes.
|
|
55
|
+
// This does not guarantee uniqueness, but is used to reduce
|
|
56
|
+
// the number of comparisons needed when checking for equality.
|
|
57
|
+
std::size_t hash;
|
|
58
|
+
|
|
59
|
+
SET_MEMORY_INFO_NAME(ModuleCacheKey)
|
|
60
|
+
SET_SELF_SIZE(ModuleCacheKey)
|
|
61
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
62
|
+
|
|
63
|
+
// Returns a string representation of the ModuleCacheKey.
|
|
64
|
+
std::string ToString() const;
|
|
65
|
+
|
|
66
|
+
template <int elements_per_attribute = 3>
|
|
67
|
+
static ModuleCacheKey From(v8::Local<v8::String> specifier,
|
|
68
|
+
v8::Local<v8::FixedArray> import_attributes);
|
|
69
|
+
static ModuleCacheKey From(v8::Local<v8::ModuleRequest> v8_request);
|
|
70
|
+
|
|
71
|
+
struct Hash {
|
|
72
|
+
std::size_t operator()(const ModuleCacheKey& request) const {
|
|
73
|
+
return request.hash;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Equality operator for ModuleCacheKey.
|
|
78
|
+
bool operator==(const ModuleCacheKey& other) const {
|
|
79
|
+
// Hash does not provide uniqueness guarantee, so ignore it.
|
|
80
|
+
return specifier == other.specifier &&
|
|
81
|
+
import_attributes == other.import_attributes;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private:
|
|
85
|
+
// Use public ModuleCacheKey::From to create instances.
|
|
86
|
+
ModuleCacheKey(std::string specifier,
|
|
87
|
+
ImportAttributeVector import_attributes,
|
|
88
|
+
std::size_t hash)
|
|
89
|
+
: specifier(specifier),
|
|
90
|
+
import_attributes(import_attributes),
|
|
91
|
+
hash(hash) {}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
class ModuleWrap : public BaseObject {
|
|
95
|
+
public:
|
|
96
|
+
enum InternalFields {
|
|
97
|
+
kModuleSlot = BaseObject::kInternalFieldCount,
|
|
98
|
+
kModuleSourceObjectSlot,
|
|
99
|
+
kSyntheticEvaluationStepsSlot,
|
|
100
|
+
kContextObjectSlot, // Object whose creation context is the target Context
|
|
101
|
+
kLinkedRequestsSlot, // Array of linked requests, each is a ModuleWrap JS
|
|
102
|
+
// wrapper object.
|
|
103
|
+
kInternalFieldCount
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
static void CreatePerIsolateProperties(IsolateData* isolate_data,
|
|
107
|
+
v8::Local<v8::ObjectTemplate> target);
|
|
108
|
+
static void CreatePerContextProperties(v8::Local<v8::Object> target,
|
|
109
|
+
v8::Local<v8::Value> unused,
|
|
110
|
+
v8::Local<v8::Context> context,
|
|
111
|
+
void* priv);
|
|
112
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
113
|
+
static void HostInitializeImportMetaObjectCallback(
|
|
114
|
+
v8::Local<v8::Context> context,
|
|
115
|
+
v8::Local<v8::Module> module,
|
|
116
|
+
v8::Local<v8::Object> meta);
|
|
117
|
+
|
|
118
|
+
v8::Local<v8::Context> context() const;
|
|
119
|
+
v8::Maybe<bool> CheckUnsettledTopLevelAwait();
|
|
120
|
+
bool HasAsyncGraph();
|
|
121
|
+
|
|
122
|
+
SET_MEMORY_INFO_NAME(ModuleWrap)
|
|
123
|
+
SET_SELF_SIZE(ModuleWrap)
|
|
124
|
+
SET_NO_MEMORY_INFO()
|
|
125
|
+
|
|
126
|
+
bool IsNotIndicativeOfMemoryLeakAtExit() const override {
|
|
127
|
+
// XXX: The garbage collection rules for ModuleWrap are *super* unclear.
|
|
128
|
+
// Do these objects ever get GC'd? Are we just okay with leaking them?
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
bool IsLinked() const { return linked_; }
|
|
133
|
+
|
|
134
|
+
static v8::Local<v8::PrimitiveArray> GetHostDefinedOptions(
|
|
135
|
+
v8::Isolate* isolate, v8::Local<v8::Symbol> symbol);
|
|
136
|
+
|
|
137
|
+
// When user_cached_data is not std::nullopt, use the code cache if it's not
|
|
138
|
+
// nullptr, otherwise don't use code cache.
|
|
139
|
+
// TODO(joyeecheung): when it is std::nullopt, use on-disk cache
|
|
140
|
+
// See: https://github.com/nodejs/node/issues/47472
|
|
141
|
+
static v8::MaybeLocal<v8::Module> CompileSourceTextModule(
|
|
142
|
+
Realm* realm,
|
|
143
|
+
v8::Local<v8::String> source_text,
|
|
144
|
+
v8::Local<v8::String> url,
|
|
145
|
+
int line_offset,
|
|
146
|
+
int column_offset,
|
|
147
|
+
v8::Local<v8::PrimitiveArray> host_defined_options,
|
|
148
|
+
std::optional<v8::ScriptCompiler::CachedData*> user_cached_data,
|
|
149
|
+
bool* cache_rejected);
|
|
150
|
+
|
|
151
|
+
static void CreateRequiredModuleFacade(
|
|
152
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
153
|
+
|
|
154
|
+
private:
|
|
155
|
+
ModuleWrap(Realm* realm,
|
|
156
|
+
v8::Local<v8::Object> object,
|
|
157
|
+
v8::Local<v8::Module> module,
|
|
158
|
+
v8::Local<v8::String> url,
|
|
159
|
+
v8::Local<v8::Object> context_object,
|
|
160
|
+
v8::Local<v8::Value> synthetic_evaluation_step);
|
|
161
|
+
~ModuleWrap() override;
|
|
162
|
+
|
|
163
|
+
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
164
|
+
static void GetModuleRequests(
|
|
165
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
166
|
+
static void SetModuleSourceObject(
|
|
167
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
168
|
+
static void GetModuleSourceObject(
|
|
169
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
170
|
+
|
|
171
|
+
static void Link(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
172
|
+
static void Instantiate(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
173
|
+
static void Evaluate(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
174
|
+
static void EvaluateSync(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
175
|
+
static void GetNamespace(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
176
|
+
static void GetStatus(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
177
|
+
static void GetError(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
178
|
+
|
|
179
|
+
static void HasAsyncGraph(v8::Local<v8::Name> property,
|
|
180
|
+
const v8::PropertyCallbackInfo<v8::Value>& args);
|
|
181
|
+
|
|
182
|
+
static void SetImportModuleDynamicallyCallback(
|
|
183
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
184
|
+
static void SetImportMetaResolveInitializer(
|
|
185
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
186
|
+
static void SetInitializeImportMetaObjectCallback(
|
|
187
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
188
|
+
static v8::MaybeLocal<v8::Value> SyntheticModuleEvaluationStepsCallback(
|
|
189
|
+
v8::Local<v8::Context> context, v8::Local<v8::Module> module);
|
|
190
|
+
static void SetSyntheticExport(
|
|
191
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
192
|
+
static void CreateCachedData(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
193
|
+
|
|
194
|
+
static v8::MaybeLocal<v8::Module> ResolveModuleCallback(
|
|
195
|
+
v8::Local<v8::Context> context,
|
|
196
|
+
size_t module_request_index,
|
|
197
|
+
v8::Local<v8::Module> referrer);
|
|
198
|
+
static v8::MaybeLocal<v8::Object> ResolveSourceCallback(
|
|
199
|
+
v8::Local<v8::Context> context,
|
|
200
|
+
size_t module_request_index,
|
|
201
|
+
v8::Local<v8::Module> referrer);
|
|
202
|
+
static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
|
|
203
|
+
|
|
204
|
+
// This method may throw a JavaScript exception, so the return type is
|
|
205
|
+
// wrapped in a Maybe.
|
|
206
|
+
static v8::Maybe<ModuleWrap*> ResolveModule(v8::Local<v8::Context> context,
|
|
207
|
+
size_t module_request_index,
|
|
208
|
+
v8::Local<v8::Module> referrer);
|
|
209
|
+
|
|
210
|
+
std::string url_;
|
|
211
|
+
v8::Global<v8::Module> module_;
|
|
212
|
+
contextify::ContextifyContext* contextify_context_ = nullptr;
|
|
213
|
+
bool synthetic_ = false;
|
|
214
|
+
bool linked_ = false;
|
|
215
|
+
// This depends on the module to be instantiated so it begins with a
|
|
216
|
+
// nullopt value.
|
|
217
|
+
std::optional<bool> has_async_graph_ = std::nullopt;
|
|
218
|
+
int module_hash_;
|
|
219
|
+
// Corresponds to the ModuleWrap* of the wrappers in kLinkedRequestsSlot.
|
|
220
|
+
// These are populated during Link(), and are only valid after that as
|
|
221
|
+
// convenient shortcuts, but do not hold the ModuleWraps alive. The actual
|
|
222
|
+
// strong references come from the array in kLinkedRequestsSlot.
|
|
223
|
+
std::vector<ModuleWrap*> linked_module_wraps_;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
} // namespace loader
|
|
227
|
+
} // namespace node
|
|
228
|
+
|
|
229
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
230
|
+
|
|
231
|
+
#endif // SRC_MODULE_WRAP_H_
|