mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
worker: add public method for marking objects as untransferable
We currently mark a number of `ArrayBuffer`s as not transferable, including the `Buffer` pool and ones with finalizers provided by C++ addons. There is no good reason to assume that userland code might not encounter similar problems, for example when doing `ArrayBuffer` pooling similar to ours. Therefore, provide an API that lets userland code also mark objects as not transferable. PR-URL: https://github.com/nodejs/node/pull/33979 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
This commit is contained in:
1 parent
ced68bfa3d
commit
4875a511ea
9 files changed
+118
-21
No files matched your search
+1
-1
@@ -29,7 +29,7 @@ struct node_napi_env__ : public napi_env__ {
|
||||
v8::Local<v8::ArrayBuffer> ab) const override {
|
||||
return ab->SetPrivate(
|
||||
context(),
|
||||
node_env()->arraybuffer_untransferable_private_symbol(),
|
||||
node_env()->untransferable_object_private_symbol(),
|
||||
v8::True(isolate));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user