mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
src: store Local for CallbackScope on stack
This is a requirement of the V8 API, but requires a separate semver-major change (as it is ABI-breaking) to address. (There's also a similar requirement for `napi_open_callback_scope` that would not be easily addressable without breaking ABI compatibility there as well. In real-world situations, it seems extremely unlikely that the `CallbackScope` would be the only reference to the resource object.) PR-URL: https://github.com/nodejs/node/pull/59705 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
parent
d58343ec48
commit
234c26cca3
|
|
@ -26,9 +26,9 @@ CallbackScope::CallbackScope(Isolate* isolate,
|
|||
CallbackScope::CallbackScope(Environment* env,
|
||||
Local<Object> object,
|
||||
async_context asyncContext)
|
||||
: private_(new InternalCallbackScope(env,
|
||||
object,
|
||||
asyncContext)),
|
||||
: resource_storage_(object),
|
||||
private_(
|
||||
new InternalCallbackScope(env, &resource_storage_, asyncContext)),
|
||||
try_catch_(env->isolate()) {
|
||||
try_catch_.SetVerbose(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1452,6 +1452,8 @@ class NODE_EXTERN CallbackScope {
|
|||
CallbackScope(CallbackScope&&) = delete;
|
||||
|
||||
private:
|
||||
void* reserved_;
|
||||
v8::Local<v8::Object> resource_storage_;
|
||||
InternalCallbackScope* private_;
|
||||
v8::TryCatch try_catch_;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user