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 19efe60

Browse filesBrowse files
addaleaxaduh95
authored andcommitted
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: #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>
1 parent 0257e80 commit 19efe60
Copy full SHA for 19efe60

2 files changed

+14Lines changed: 14 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/async_wrap.cc‎

Copy file name to clipboardExpand all lines: src/async_wrap.cc
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,13 @@ void AsyncWrap::AsyncReset(const FunctionCallbackInfo<Value>& args) {
322322
wrap->AsyncReset(resource, execution_async_id);
323323
}
324324

325+
// Useful for debugging async context propagation. Not intended for public use.
326+
void AsyncWrap::GetAsyncContextFrame(const FunctionCallbackInfo<Value>& args) {
327+
AsyncWrap* wrap;
328+
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This());
329+
330+
args.GetReturnValue().Set(wrap->context_frame());
331+
}
325332

326333
void AsyncWrap::GetProviderType(const FunctionCallbackInfo<Value>& args) {
327334
AsyncWrap* wrap;
@@ -372,6 +379,10 @@ Local<FunctionTemplate> AsyncWrap::GetConstructorTemplate(
372379
FIXED_ONE_BYTE_STRING(isolate_data->isolate(), "AsyncWrap"));
373380
SetProtoMethod(isolate, tmpl, "getAsyncId", AsyncWrap::GetAsyncId);
374381
SetProtoMethod(isolate, tmpl, "asyncReset", AsyncWrap::AsyncReset);
382+
SetProtoMethod(isolate,
383+
tmpl,
384+
"getAsyncContextFrameForDebuggingOnly",
385+
AsyncWrap::GetAsyncContextFrame);
375386
SetProtoMethod(
376387
isolate, tmpl, "getProviderType", AsyncWrap::GetProviderType);
377388
isolate_data->set_async_wrap_ctor_template(tmpl);
@@ -501,6 +512,7 @@ void AsyncWrap::RegisterExternalReferences(
501512
registry->Register(RegisterDestroyHook);
502513
registry->Register(AsyncWrap::GetAsyncId);
503514
registry->Register(AsyncWrap::AsyncReset);
515+
registry->Register(AsyncWrap::GetAsyncContextFrame);
504516
registry->Register(AsyncWrap::GetProviderType);
505517
}
506518

Collapse file

‎src/async_wrap.h‎

Copy file name to clipboardExpand all lines: src/async_wrap.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ class AsyncWrap : public BaseObject {
166166
static void ClearAsyncIdStack(
167167
const v8::FunctionCallbackInfo<v8::Value>& args);
168168
static void AsyncReset(const v8::FunctionCallbackInfo<v8::Value>& args);
169+
static void GetAsyncContextFrame(
170+
const v8::FunctionCallbackInfo<v8::Value>& args);
169171
static void GetProviderType(const v8::FunctionCallbackInfo<v8::Value>& args);
170172
static void QueueDestroyAsyncId(
171173
const v8::FunctionCallbackInfo<v8::Value>& args);

0 commit comments

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