@@ -363,7 +363,7 @@ static void CheckImmediate(uv_check_t* handle) {
363363 env->immediate_callback_string (),
364364 0 ,
365365 nullptr ,
366- 0 , 0 ).ToLocalChecked ();
366+ { 0 , 0 } ).ToLocalChecked ();
367367}
368368
369369
@@ -1298,8 +1298,7 @@ MaybeLocal<Value> MakeCallback(Environment* env,
12981298 const Local<Function> callback,
12991299 int argc,
13001300 Local<Value> argv[],
1301- double async_id,
1302- double trigger_id) {
1301+ async_context asyncContext) {
13031302 // If you hit this assertion, you forgot to enter the v8::Context first.
13041303 CHECK_EQ (env->context (), env->isolate ()->GetCurrentContext ());
13051304
@@ -1321,10 +1320,12 @@ MaybeLocal<Value> MakeCallback(Environment* env,
13211320 MaybeLocal<Value> ret;
13221321
13231322 {
1324- AsyncHooks::ExecScope exec_scope (env, async_id, trigger_id);
1323+ AsyncHooks::ExecScope exec_scope (env, asyncContext.async_id ,
1324+ asyncContext.trigger_async_id );
13251325
1326- if (async_id != 0 ) {
1327- if (!AsyncWrap::EmitBefore (env, async_id)) return Local<Value>();
1326+ if (asyncContext.async_id != 0 ) {
1327+ if (!AsyncWrap::EmitBefore (env, asyncContext.async_id ))
1328+ return Local<Value>();
13281329 }
13291330
13301331 ret = callback->Call (env->context (), recv, argc, argv);
@@ -1336,8 +1337,9 @@ MaybeLocal<Value> MakeCallback(Environment* env,
13361337 ret : Undefined (env->isolate ());
13371338 }
13381339
1339- if (async_id != 0 ) {
1340- if (!AsyncWrap::EmitAfter (env, async_id)) return Local<Value>();
1340+ if (asyncContext.async_id != 0 ) {
1341+ if (!AsyncWrap::EmitAfter (env, asyncContext.async_id ))
1342+ return Local<Value>();
13411343 }
13421344 }
13431345
@@ -1358,8 +1360,8 @@ MaybeLocal<Value> MakeCallback(Environment* env,
13581360
13591361 // Make sure the stack unwound properly. If there are nested MakeCallback's
13601362 // then it should return early and not reach this code.
1361- CHECK_EQ (env->current_async_id (), async_id);
1362- CHECK_EQ (env->trigger_id (), trigger_id );
1363+ CHECK_EQ (env->current_async_id (), asyncContext. async_id );
1364+ CHECK_EQ (env->trigger_id (), asyncContext. trigger_async_id );
13631365
13641366 Local<Object> process = env->process_object ();
13651367
@@ -1384,13 +1386,11 @@ MaybeLocal<Value> MakeCallback(Isolate* isolate,
13841386 const char * method,
13851387 int argc,
13861388 Local<Value> argv[],
1387- async_uid async_id,
1388- async_uid trigger_id) {
1389+ async_context asyncContext) {
13891390 Local<String> method_string =
13901391 String::NewFromUtf8 (isolate, method, v8::NewStringType::kNormal )
13911392 .ToLocalChecked ();
1392- return MakeCallback (isolate, recv, method_string, argc, argv,
1393- async_id, trigger_id);
1393+ return MakeCallback (isolate, recv, method_string, argc, argv, asyncContext);
13941394}
13951395
13961396
@@ -1399,14 +1399,12 @@ MaybeLocal<Value> MakeCallback(Isolate* isolate,
13991399 Local<String> symbol,
14001400 int argc,
14011401 Local<Value> argv[],
1402- async_uid async_id,
1403- async_uid trigger_id) {
1402+ async_context asyncContext) {
14041403 Local<Value> callback_v = recv->Get (symbol);
14051404 if (callback_v.IsEmpty ()) return Local<Value>();
14061405 if (!callback_v->IsFunction ()) return Local<Value>();
14071406 Local<Function> callback = callback_v.As <Function>();
1408- return MakeCallback (isolate, recv, callback, argc, argv,
1409- async_id, trigger_id);
1407+ return MakeCallback (isolate, recv, callback, argc, argv, asyncContext);
14101408}
14111409
14121410
@@ -1415,8 +1413,7 @@ MaybeLocal<Value> MakeCallback(Isolate* isolate,
14151413 Local<Function> callback,
14161414 int argc,
14171415 Local<Value> argv[],
1418- async_uid async_id,
1419- async_uid trigger_id) {
1416+ async_context asyncContext) {
14201417 // Observe the following two subtleties:
14211418 //
14221419 // 1. The environment is retrieved from the callback function's context.
@@ -1427,7 +1424,7 @@ MaybeLocal<Value> MakeCallback(Isolate* isolate,
14271424 Environment* env = Environment::GetCurrent (callback->CreationContext ());
14281425 Context::Scope context_scope (env->context ());
14291426 return MakeCallback (env, recv.As <Value>(), callback, argc, argv,
1430- async_id, trigger_id );
1427+ asyncContext );
14311428}
14321429
14331430
@@ -1440,7 +1437,7 @@ Local<Value> MakeCallback(Isolate* isolate,
14401437 Local<Value>* argv) {
14411438 EscapableHandleScope handle_scope (isolate);
14421439 return handle_scope.Escape (
1443- MakeCallback (isolate, recv, method, argc, argv, 0 , 0 )
1440+ MakeCallback (isolate, recv, method, argc, argv, { 0 , 0 } )
14441441 .FromMaybe (Local<Value>()));
14451442}
14461443
@@ -1452,7 +1449,7 @@ Local<Value> MakeCallback(Isolate* isolate,
14521449 Local<Value>* argv) {
14531450 EscapableHandleScope handle_scope (isolate);
14541451 return handle_scope.Escape (
1455- MakeCallback (isolate, recv, symbol, argc, argv, 0 , 0 )
1452+ MakeCallback (isolate, recv, symbol, argc, argv, { 0 , 0 } )
14561453 .FromMaybe (Local<Value>()));
14571454}
14581455
@@ -1464,7 +1461,7 @@ Local<Value> MakeCallback(Isolate* isolate,
14641461 Local<Value>* argv) {
14651462 EscapableHandleScope handle_scope (isolate);
14661463 return handle_scope.Escape (
1467- MakeCallback (isolate, recv, callback, argc, argv, 0 , 0 )
1464+ MakeCallback (isolate, recv, callback, argc, argv, { 0 , 0 } )
14681465 .FromMaybe (Local<Value>()));
14691466}
14701467
@@ -4448,7 +4445,7 @@ void EmitBeforeExit(Environment* env) {
44484445 };
44494446 MakeCallback (env->isolate (),
44504447 process_object, " emit" , arraysize (args), args,
4451- 0 , 0 ).ToLocalChecked ();
4448+ { 0 , 0 } ).ToLocalChecked ();
44524449}
44534450
44544451
@@ -4469,7 +4466,7 @@ int EmitExit(Environment* env) {
44694466
44704467 MakeCallback (env->isolate (),
44714468 process_object, " emit" , arraysize (args), args,
4472- 0 , 0 ).ToLocalChecked ();
4469+ { 0 , 0 } ).ToLocalChecked ();
44734470
44744471 // Reload exit code, it may be changed by `emit('exit')`
44754472 return process_object->Get (exitCode)->Int32Value ();
0 commit comments