Skip to content
This repository was archived by the owner on Aug 31, 2018. It is now read-only.

Commit 9d4c1da

Browse files
addaleaxQard
authored andcommitted
src: add InternalCallbackScope util constructor
Add an utility constructor for `AsyncWrap` classes that wish to leverage `InternalCallbackScope`s. PR-URL: nodejs/node#16461 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent e15560b commit 9d4c1da

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/node.cc

+6
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,12 @@ CallbackScope::~CallbackScope() {
14001400
delete private_;
14011401
}
14021402

1403+
InternalCallbackScope::InternalCallbackScope(AsyncWrap* async_wrap)
1404+
: InternalCallbackScope(async_wrap->env(),
1405+
async_wrap->object(),
1406+
{ async_wrap->get_async_id(),
1407+
async_wrap->get_trigger_async_id() }) {}
1408+
14031409
InternalCallbackScope::InternalCallbackScope(Environment* env,
14041410
Local<Object> object,
14051411
const async_context& asyncContext,

src/node_internals.h

+2
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ class InternalCallbackScope {
307307
v8::Local<v8::Object> object,
308308
const async_context& asyncContext,
309309
ResourceExpectation expect = kRequireResource);
310+
// Utility that can be used by AsyncWrap classes.
311+
explicit InternalCallbackScope(AsyncWrap* async_wrap);
310312
~InternalCallbackScope();
311313
void Close();
312314

0 commit comments

Comments
 (0)