summaryrefslogtreecommitdiff
path: root/src/node_task_queue.cc
AgeCommit message (Collapse)Author
2019-01-06src: remove unused isolate variableDaniel Bevenius
Currently the following compiler warning is generated: ../src/node_task_queue.cc:93:12: warning: unused variable 'isolate' [-Wunused-variable] Isolate* isolate = env->isolate(); ^ 1 warning generated. This commit removes the unused variable. PR-URL: https://github.com/nodejs/node/pull/25368 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-01-06process: make tick callback and promise rejection callback more robustJoyee Cheung
- Rename `internalTickCallback` to `processTicksAndRejections`, make sure it does not get called if it's not set in C++. - Rename `emitPromiseRejectionWarnings` to `processPromiseRejections` since it also emit events that are not warnings. - Sets `SetPromiseRejectCallback` in the `Environment` constructor to make sure it only gets called once per-isolate, and make sure it does not get called if it's not set in C++. - Wrap promise rejection callback initialization into `listenForRejections()`. - Add comments. PR-URL: https://github.com/nodejs/node/pull/25200 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-01-06src: refactor tickInfo accessJoyee Cheung
- Wrap access to tickInfo fields in functions - Rename `kHasScheduled` to `kHasTickScheduled` and `kHasPromiseRejections` to `kHasRejectionToWarn` for clarity - note the latter will be set to false if the rejection does not lead to a warning so the previous description is not accurate. - Set `kHasRejectionToWarn` in JS land of relying on C++ to use an implict contract (return value of the promise rejection handler) to set it, as the decision is made entirely in JS land. - Destructure promise reject event constants. PR-URL: https://github.com/nodejs/node/pull/25200 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-12-24src: move process.nextTick and promise setup into node_task_queue.ccJoyee Cheung
This patch: - Moves the process.nextTick and promise setup C++ code into node_task_queue.cc which is exposed as `internalBinding('task_queue')` - Makes `lib/internal/process/promises.js` and `lib/internal/process/next_tick.js` as side-effect-free as possible - Removes the bootstrapper object being passed into `bootstrap/node.js`, let `next_tick.js` and `promises.js` load whatever they need from `internalBinding('task_queue')` instead. - Rename `process._tickCallback` to `runNextTicks` internally for clarity but still expose it as `process._tickCallback`. PR-URL: https://github.com/nodejs/node/pull/25163 Refs: https://github.com/nodejs/node/issues/24961 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>