mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
src: expose async context frame debugging helper to JS
This was invaluable for debugging the previous change, so I'm suggesting we add it regardless of it being a debugging-only API. PR-URL: https://github.com/nodejs/node/pull/62103 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
1 parent
6ad5f7cb80
commit
50fe010252
2 files changed
+14
No files matched your search
@@ -322,6 +322,13 @@ void AsyncWrap::AsyncReset(const FunctionCallbackInfo<Value>& args) {
|
||||
wrap->AsyncReset(resource, execution_async_id);
|
||||
}
|
||||
|
||||
// Useful for debugging async context propagation. Not intended for public use.
|
||||
void AsyncWrap::GetAsyncContextFrame(const FunctionCallbackInfo<Value>& args) {
|
||||
AsyncWrap* wrap;
|
||||
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This());
|
||||
|
||||
args.GetReturnValue().Set(wrap->context_frame());
|
||||
}
|
||||
|
||||
void AsyncWrap::GetProviderType(const FunctionCallbackInfo<Value>& args) {
|
||||
AsyncWrap* wrap;
|
||||
@@ -372,6 +379,10 @@ Local<FunctionTemplate> AsyncWrap::GetConstructorTemplate(
|
||||
FIXED_ONE_BYTE_STRING(isolate_data->isolate(), "AsyncWrap"));
|
||||
SetProtoMethod(isolate, tmpl, "getAsyncId", AsyncWrap::GetAsyncId);
|
||||
SetProtoMethod(isolate, tmpl, "asyncReset", AsyncWrap::AsyncReset);
|
||||
SetProtoMethod(isolate,
|
||||
tmpl,
|
||||
"getAsyncContextFrameForDebuggingOnly",
|
||||
AsyncWrap::GetAsyncContextFrame);
|
||||
SetProtoMethod(
|
||||
isolate, tmpl, "getProviderType", AsyncWrap::GetProviderType);
|
||||
isolate_data->set_async_wrap_ctor_template(tmpl);
|
||||
@@ -501,6 +512,7 @@ void AsyncWrap::RegisterExternalReferences(
|
||||
registry->Register(RegisterDestroyHook);
|
||||
registry->Register(AsyncWrap::GetAsyncId);
|
||||
registry->Register(AsyncWrap::AsyncReset);
|
||||
registry->Register(AsyncWrap::GetAsyncContextFrame);
|
||||
registry->Register(AsyncWrap::GetProviderType);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +167,8 @@ class AsyncWrap : public BaseObject {
|
||||
static void ClearAsyncIdStack(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void AsyncReset(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void GetAsyncContextFrame(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void GetProviderType(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void QueueDestroyAsyncId(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
Reference in new issue
Block a user