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

Commit 542f1eb

Browse files
committed
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 01e2277 commit 542f1eb

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
@@ -1405,6 +1405,12 @@ CallbackScope::~CallbackScope() {
14051405
delete private_;
14061406
}
14071407

1408+
InternalCallbackScope::InternalCallbackScope(AsyncWrap* async_wrap)
1409+
: InternalCallbackScope(async_wrap->env(),
1410+
async_wrap->object(),
1411+
{ async_wrap->get_async_id(),
1412+
async_wrap->get_trigger_async_id() }) {}
1413+
14081414
InternalCallbackScope::InternalCallbackScope(Environment* env,
14091415
Local<Object> object,
14101416
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)