diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2020-04-19 22:51:05 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-05-06 07:44:04 +0300 |
commit | 86fdaa745572a3bec4370ac7bd05d18e6bf64c01 (patch) | |
tree | 45890dbc713ad29edd830fd2aa17f592909ccbb7 /src/node_file.h | |
parent | f446b2058dcfaf9d4e2f6bdfe555bc4437f41acf (diff) |
src: retrieve binding data from the context
Instead of passing them through the data bound to function
templates, store references to them in a list embedded inside
the context.
This makes the function templates more context-independent,
and makes it possible to embed binding data in non-main contexts.
Co-authored-by: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/33139
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node_file.h')
-rw-r--r-- | src/node_file.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/node_file.h b/src/node_file.h index 1fda81361fe..7690f272848 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -16,9 +16,9 @@ class FileHandleReadWrap; class BindingData : public BaseObject { public: explicit BindingData(Environment* env, v8::Local<v8::Object> wrap) - : BaseObject(env, wrap), - stats_field_array(env->isolate(), kFsStatsBufferLength), - stats_field_bigint_array(env->isolate(), kFsStatsBufferLength) {} + : BaseObject(env, wrap), + stats_field_array(env->isolate(), kFsStatsBufferLength), + stats_field_bigint_array(env->isolate(), kFsStatsBufferLength) {} AliasedFloat64Array stats_field_array; AliasedBigUint64Array stats_field_bigint_array; @@ -26,6 +26,8 @@ class BindingData : public BaseObject { std::vector<BaseObjectPtr<FileHandleReadWrap>> file_handle_read_wrap_freelist; + static constexpr FastStringKey binding_data_name { "fs" }; + void MemoryInfo(MemoryTracker* tracker) const override; SET_SELF_SIZE(BindingData) SET_MEMORY_INFO_NAME(BindingData) |