diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-11-03 15:28:34 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2019-11-17 10:59:08 +0300 |
commit | 0072a8eddfe4bb444856c1aea09ed72bf6d359d5 (patch) | |
tree | 3cc9e79c80f9c7fd206d40a8f4dba6a0cdf2d590 /src/node_http_parser.cc | |
parent | e3371f0c93b7f3fa66381aad393cc4b5eb9b9dca (diff) |
src: remove AsyncScope and AsyncCallbackScope
Reduce the number of different scopes we use for async callbacks.
PR-URL: https://github.com/nodejs/node/pull/30236
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_http_parser.cc')
-rw-r--r-- | src/node_http_parser.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 33769869992..bfc1582b468 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -310,10 +310,13 @@ class Parser : public AsyncWrap, public StreamListener { argv[A_UPGRADE] = Boolean::New(env()->isolate(), parser_.upgrade); - AsyncCallbackScope callback_scope(env()); - - MaybeLocal<Value> head_response = - MakeCallback(cb.As<Function>(), arraysize(argv), argv); + MaybeLocal<Value> head_response; + { + InternalCallbackScope callback_scope( + this, InternalCallbackScope::kSkipTaskQueues); + head_response = cb.As<Function>()->Call( + env()->context(), object(), arraysize(argv), argv); + } int64_t val; @@ -379,9 +382,12 @@ class Parser : public AsyncWrap, public StreamListener { if (!cb->IsFunction()) return 0; - AsyncCallbackScope callback_scope(env()); - - MaybeLocal<Value> r = MakeCallback(cb.As<Function>(), 0, nullptr); + MaybeLocal<Value> r; + { + InternalCallbackScope callback_scope( + this, InternalCallbackScope::kSkipTaskQueues); + r = cb.As<Function>()->Call(env()->context(), object(), 0, nullptr); + } if (r.IsEmpty()) { got_exception_ = true; |