diff options
author | Andreas Madsen <amwebdk@gmail.com> | 2017-07-17 16:47:12 -0700 |
---|---|---|
committer | Andreas Madsen <amwebdk@gmail.com> | 2017-11-16 11:46:54 +0100 |
commit | d217b2850efb9005819d55b697a37cbe5bd0003c (patch) | |
tree | 58177a7aa0d00ece9133ac6c2120e2adb940f527 /src/node_http_parser.cc | |
parent | ed0327b8868cc3df981f81be6409586b97d06ac8 (diff) | |
download | node-new-d217b2850efb9005819d55b697a37cbe5bd0003c.tar.gz |
async_hooks: add trace events to async_hooks
This will allow trace event to record timing information for all
asynchronous operations that are observed by async_hooks.
PR-URL: https://github.com/nodejs/node/pull/15538
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_http_parser.cc')
-rw-r--r-- | src/node_http_parser.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index ccb0942609..9974f566a8 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -397,6 +397,18 @@ class Parser : public AsyncWrap { } + static void Free(const FunctionCallbackInfo<Value>& args) { + Environment* env = Environment::GetCurrent(args); + Parser* parser; + ASSIGN_OR_RETURN_UNWRAP(&parser, args.Holder()); + + // Since the Parser destructor isn't going to run the destroy() callbacks + // it needs to be triggered manually. + parser->EmitTraceEventDestroy(); + parser->EmitDestroy(env, parser->get_async_id()); + } + + void Save() { url_.Save(); status_message_.Save(); @@ -792,6 +804,7 @@ void InitHttpParser(Local<Object> target, AsyncWrap::AddWrapMethods(env, t); env->SetProtoMethod(t, "close", Parser::Close); + env->SetProtoMethod(t, "free", Parser::Free); env->SetProtoMethod(t, "execute", Parser::Execute); env->SetProtoMethod(t, "finish", Parser::Finish); env->SetProtoMethod(t, "reinitialize", Parser::Reinitialize); |