Skip to content

Commit 9c4090e

Browse files
committed
Store sampling context as a map element. This ensures propagation.
See node/lib/internal/async_context_frame.js AsyncContextFrame constructor.
1 parent 72c0e74 commit 9c4090e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bindings/profilers/wall.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,13 +1035,13 @@ void WallProfiler::SetContext(Isolate* isolate, Local<Value> value) {
10351035

10361036
auto cped = isolate->GetContinuationPreservedEmbedderData();
10371037
// No Node AsyncContextFrame in this continuation yet
1038-
if (!cped->IsObject()) return;
1038+
if (!cped->IsMap()) return;
10391039

10401040
auto v8Ctx = isolate->GetCurrentContext();
10411041
// This should always be called from a V8 context, but check just in case.
10421042
if (v8Ctx.IsEmpty()) return;
10431043

1044-
auto cpedObj = cped.As<Object>();
1044+
auto cpedObj = cped.As<Map>();
10451045
auto localSymbol = cpedSymbol_.Get(isolate);
10461046
auto maybeProfData = cpedObj->Get(v8Ctx, localSymbol);
10471047
if (maybeProfData.IsEmpty()) return;
@@ -1057,7 +1057,7 @@ void WallProfiler::SetContext(Isolate* isolate, Local<Value> value) {
10571057
auto maybeSetResult = cpedObj->Set(v8Ctx, localSymbol, external);
10581058
std::atomic_signal_fence(std::memory_order_release);
10591059
setInProgress.store(false, std::memory_order_relaxed);
1060-
if (maybeSetResult.IsNothing()) {
1060+
if (maybeSetResult.IsEmpty()) {
10611061
delete contextPtr;
10621062
return;
10631063
}
@@ -1107,12 +1107,12 @@ ContextPtr WallProfiler::GetContextPtr(Isolate* isolate) {
11071107
#define RETURN_EMPTY_IF(x) if (x) return std::shared_ptr<Global<Value>>()
11081108

11091109
auto cped = isolate->GetContinuationPreservedEmbedderData();
1110-
RETURN_EMPTY_IF(!cped->IsObject());
1110+
RETURN_EMPTY_IF(!cped->IsMap());
11111111

11121112
auto v8Ctx = isolate->GetEnteredOrMicrotaskContext();
11131113
RETURN_EMPTY_IF(v8Ctx.IsEmpty());
11141114

1115-
auto cpedObj = cped.As<Object>();
1115+
auto cpedObj = cped.As<Map>();
11161116
auto localSymbol = cpedSymbol_.Get(isolate);
11171117
auto maybeProfData = cpedObj->Get(v8Ctx, localSymbol);
11181118
RETURN_EMPTY_IF(maybeProfData.IsEmpty());

0 commit comments

Comments
 (0)