diff --git a/src/node.cc b/src/node.cc index c5f1a89c2bfa3a..7a7db9140f88a4 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1381,6 +1381,12 @@ CallbackScope::~CallbackScope() { delete private_; } +InternalCallbackScope::InternalCallbackScope(AsyncWrap* async_wrap) + : InternalCallbackScope(async_wrap->env(), + async_wrap->object(), + { async_wrap->get_async_id(), + async_wrap->get_trigger_async_id() }) {} + InternalCallbackScope::InternalCallbackScope(Environment* env, Local object, const async_context& asyncContext, diff --git a/src/node_internals.h b/src/node_internals.h index 050fab2a256db9..e2e81d61e31bd4 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -282,6 +282,8 @@ class InternalCallbackScope { v8::Local object, const async_context& asyncContext, ResourceExpectation expect = kRequireResource); + // Utility that can be used by AsyncWrap classes. + explicit InternalCallbackScope(AsyncWrap* async_wrap); ~InternalCallbackScope(); void Close();