Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e578268

Browse filesBrowse files
addaleaxMylesBorins
authored andcommitted
src: add InternalCallbackScope util constructor
Add an utility constructor for `AsyncWrap` classes that wish to leverage `InternalCallbackScope`s. PR-URL: #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 5390d7e commit e578268
Copy full SHA for e578268

File tree

Expand file treeCollapse file tree

2 files changed

+8
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-0
lines changed
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,12 @@ CallbackScope::~CallbackScope() {
13811381
delete private_;
13821382
}
13831383

1384+
InternalCallbackScope::InternalCallbackScope(AsyncWrap* async_wrap)
1385+
: InternalCallbackScope(async_wrap->env(),
1386+
async_wrap->object(),
1387+
{ async_wrap->get_async_id(),
1388+
async_wrap->get_trigger_async_id() }) {}
1389+
13841390
InternalCallbackScope::InternalCallbackScope(Environment* env,
13851391
Local<Object> object,
13861392
const async_context& asyncContext,
Collapse file

‎src/node_internals.h‎

Copy file name to clipboardExpand all lines: src/node_internals.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ class InternalCallbackScope {
282282
v8::Local<v8::Object> object,
283283
const async_context& asyncContext,
284284
ResourceExpectation expect = kRequireResource);
285+
// Utility that can be used by AsyncWrap classes.
286+
explicit InternalCallbackScope(AsyncWrap* async_wrap);
285287
~InternalCallbackScope();
286288
void Close();
287289

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.