| 117 | } |
| 118 | |
| 119 | function callbackTrampoline(asyncId, resource, cb, ...args) { |
| 120 | const index = async_hook_fields[kStackLength] - 1; |
| 121 | execution_async_resources[index] = resource; |
| 122 | |
| 123 | if (asyncId !== 0 && hasHooks(kBefore)) |
| 124 | emitBeforeNative(asyncId); |
| 125 | |
| 126 | let result; |
| 127 | if (asyncId === 0 && typeof domain_cb === 'function') { |
| 128 | args.unshift(cb); |
| 129 | result = ReflectApply(domain_cb, this, args); |
| 130 | } else { |
| 131 | result = ReflectApply(cb, this, args); |
| 132 | } |
| 133 | |
| 134 | if (asyncId !== 0 && hasHooks(kAfter)) |
| 135 | emitAfterNative(asyncId); |
| 136 | |
| 137 | execution_async_resources.pop(); |
| 138 | return result; |
| 139 | } |
| 140 | |
| 141 | const topLevelResource = {}; |
| 142 | |