From 6cb8e4b12cd16ae8ed126f98458efb78312cabf6 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 13 Nov 2019 19:19:54 +0000 Subject: src: mark ArrayBuffers with free callbacks as untransferable More precisely, make them untransferable if they were created through *our* APIs, because those do not follow the improved free callback mechanism that V8 uses now. All other ArrayBuffers can be transferred between threads now, the assumption being that they were created in a clean way that follows the V8 API on this. This addresses a TODO comment. Refs: https://github.com/nodejs/node/pull/30339#issuecomment-552225353 PR-URL: https://github.com/nodejs/node/pull/30475 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: David Carlier --- src/js_native_api_v8.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/js_native_api_v8.h') diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h index 2e0a7a1d6a..534b09851f 100644 --- a/src/js_native_api_v8.h +++ b/src/js_native_api_v8.h @@ -39,6 +39,10 @@ struct napi_env__ { inline void Unref() { if ( --refs == 0) delete this; } virtual bool can_call_into_js() const { return true; } + virtual v8::Maybe mark_arraybuffer_as_untransferable( + v8::Local ab) const { + return v8::Just(true); + } template void CallIntoModule(T&& call, U&& handle_exception) { -- cgit v1.2.3