From d80e49d6801501a0f2b93c442d5e425ed6fc73fb Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 3 Nov 2019 13:00:24 +0100 Subject: src: use callback scope for main script This allows removing custom code for setting the current async ids and running nextTicks. PR-URL: https://github.com/nodejs/node/pull/30236 Reviewed-By: Franziska Hinkelmann Reviewed-By: Gus Caplan Reviewed-By: David Carlier Reviewed-By: James M Snell --- src/node_internals.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/node_internals.h') diff --git a/src/node_internals.h b/src/node_internals.h index 2ec230d8b5..106f6613f1 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -203,12 +203,16 @@ v8::MaybeLocal InternalMakeCallback( class InternalCallbackScope { public: - // Tell the constructor whether its `object` parameter may be empty or not. - enum ResourceExpectation { kRequireResource, kAllowEmptyResource }; + enum Flags { + // Tell the constructor whether its `object` parameter may be empty or not. + kAllowEmptyResource = 1, + // Indicates whether 'before' and 'after' hooks should be skipped. + kSkipAsyncHooks = 2 + }; InternalCallbackScope(Environment* env, v8::Local object, const async_context& asyncContext, - ResourceExpectation expect = kRequireResource); + int flags = 0); // Utility that can be used by AsyncWrap classes. explicit InternalCallbackScope(AsyncWrap* async_wrap); ~InternalCallbackScope(); @@ -222,6 +226,7 @@ class InternalCallbackScope { async_context async_context_; v8::Local object_; AsyncCallbackScope callback_scope_; + bool skip_hooks_; bool failed_ = false; bool pushed_ids_ = false; bool closed_ = false; -- cgit v1.2.3