@@ -57,7 +57,7 @@ const emitDestroyNative = emitHookFactory(destroy_symbol, 'emitDestroyNative');
57
57
// process. They use the same functions as the JS embedder API. These callbacks
58
58
// are setup immediately to prevent async_wrap.setupHooks() from being hijacked
59
59
// and the cost of doing so is negligible.
60
- async_wrap . setupHooks ( { init,
60
+ async_wrap . setupHooks ( { init : emitInitNative ,
61
61
before : emitBeforeNative ,
62
62
after : emitAfterNative ,
63
63
destroy : emitDestroyNative } ) ;
@@ -228,21 +228,21 @@ class AsyncResource {
228
228
if ( async_hook_fields [ kInit ] === 0 )
229
229
return ;
230
230
231
- init ( this [ async_id_symbol ] , type , triggerAsyncId , this ) ;
231
+ emitInitNative ( this [ async_id_symbol ] , type , triggerAsyncId , this ) ;
232
232
}
233
233
234
234
emitBefore ( ) {
235
- emitBeforeS ( this [ async_id_symbol ] , this [ trigger_id_symbol ] ) ;
235
+ emitBeforeScript ( this [ async_id_symbol ] , this [ trigger_id_symbol ] ) ;
236
236
return this ;
237
237
}
238
238
239
239
emitAfter ( ) {
240
- emitAfterS ( this [ async_id_symbol ] ) ;
240
+ emitAfterScript ( this [ async_id_symbol ] ) ;
241
241
return this ;
242
242
}
243
243
244
244
emitDestroy ( ) {
245
- emitDestroyS ( this [ async_id_symbol ] ) ;
245
+ emitDestroyScript ( this [ async_id_symbol ] ) ;
246
246
return this ;
247
247
}
248
248
@@ -311,7 +311,7 @@ function setInitTriggerId(triggerAsyncId) {
311
311
}
312
312
313
313
314
- function emitInitS ( asyncId , type , triggerAsyncId , resource ) {
314
+ function emitInitScript ( asyncId , type , triggerAsyncId , resource ) {
315
315
// Short circuit all checks for the common case. Which is that no hooks have
316
316
// been set. Do this to remove performance impact for embedders (and core).
317
317
// Even though it bypasses all the argument checks. The performance savings
@@ -334,7 +334,7 @@ function emitInitS(asyncId, type, triggerAsyncId, resource) {
334
334
if ( ! Number . isSafeInteger ( triggerAsyncId ) || triggerAsyncId < 0 )
335
335
throw new RangeError ( 'triggerAsyncId must be an unsigned integer' ) ;
336
336
337
- init ( asyncId , type , triggerAsyncId , resource ) ;
337
+ emitInitNative ( asyncId , type , triggerAsyncId , resource ) ;
338
338
}
339
339
340
340
function emitHookFactory ( symbol , name ) {
@@ -370,9 +370,7 @@ function emitHookFactory(symbol, name) {
370
370
}
371
371
372
372
373
- // Usage: emitBeforeS(asyncId[, triggerAsyncId]). If triggerAsyncId is omitted
374
- // then asyncId will be used instead.
375
- function emitBeforeS ( asyncId , triggerAsyncId ) {
373
+ function emitBeforeScript ( asyncId , triggerAsyncId ) {
376
374
// CHECK(Number.isSafeInteger(asyncId) && asyncId > 0)
377
375
// CHECK(Number.isSafeInteger(triggerAsyncId) && triggerAsyncId > 0)
378
376
@@ -392,15 +390,15 @@ function emitBeforeS(asyncId, triggerAsyncId) {
392
390
// TODO(trevnorris): Calling emitBefore/emitAfter from native can't adjust the
393
391
// kIdStackIndex. But what happens if the user doesn't have both before and
394
392
// after callbacks.
395
- function emitAfterS ( asyncId ) {
393
+ function emitAfterScript ( asyncId ) {
396
394
if ( async_hook_fields [ kAfter ] > 0 )
397
395
emitAfterNative ( asyncId ) ;
398
396
399
397
popAsyncIds ( asyncId ) ;
400
398
}
401
399
402
400
403
- function emitDestroyS ( asyncId ) {
401
+ function emitDestroyScript ( asyncId ) {
404
402
// Return early if there are no destroy callbacks, or on attempt to emit
405
403
// destroy on the void.
406
404
if ( async_hook_fields [ kDestroy ] === 0 || asyncId === 0 )
@@ -422,7 +420,7 @@ function emitDestroyS(asyncId) {
422
420
// change in the future depending on whether it can be determined if there's a
423
421
// slim chance of the application remaining stable after handling one of these
424
422
// exceptions.
425
- function init ( asyncId , type , triggerAsyncId , resource ) {
423
+ function emitInitNative ( asyncId , type , triggerAsyncId , resource ) {
426
424
processing_hook += 1 ;
427
425
// Use a single try/catch for all hook to avoid setting up one per iteration.
428
426
try {
@@ -467,10 +465,10 @@ module.exports = {
467
465
newUid,
468
466
initTriggerId,
469
467
setInitTriggerId,
470
- emitInit : emitInitS ,
471
- emitBefore : emitBeforeS ,
472
- emitAfter : emitAfterS ,
473
- emitDestroy : emitDestroyS ,
468
+ emitInit : emitInitScript ,
469
+ emitBefore : emitBeforeScript ,
470
+ emitAfter : emitAfterScript ,
471
+ emitDestroy : emitDestroyScript ,
474
472
} ;
475
473
476
474
// currentId was renamed to executionAsyncId. This was in 8.2.0 during the
0 commit comments