added
c++
labels
Sep 9, 2025This is a follow-up to 234c26c . The Node-API interface does not allow us to enforce that values are stored in a specific location, e.g. on the stack or not; however, V8 requires `Local<>` handles to be stored on the stack. To circumvent this restriction, we add the ability to the async handle stack to store either `Local<>*` pointers or `Global<>*` pointers, with Node-API making use of the latter.
There already is an existing requirement to have matching calls of `napi_async_init()` and `napi_async_destroy()`, so expecting users of this API to manually hold onto the resource for the duration of the `napi_async_context`'s lifetime is unnecessary. Weak callbacks are generally useful for when a corresponding C++ object should be cleaned up when a JS object is gargbage-collected, but that is not the case here.
addaleax
added
author ready
labels
Sep 22, 2025nodejs-github-bot pushed a commit that referenced this pull request
Sep 22, 2025This is a follow-up to 234c26c . The Node-API interface does not allow us to enforce that values are stored in a specific location, e.g. on the stack or not; however, V8 requires `Local<>` handles to be stored on the stack. To circumvent this restriction, we add the ability to the async handle stack to store either `Local<>*` pointers or `Global<>*` pointers, with Node-API making use of the latter. PR-URL: #59828 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request
Sep 22, 2025There already is an existing requirement to have matching calls of `napi_async_init()` and `napi_async_destroy()`, so expecting users of this API to manually hold onto the resource for the duration of the `napi_async_context`'s lifetime is unnecessary. Weak callbacks are generally useful for when a corresponding C++ object should be cleaned up when a JS object is gargbage-collected, but that is not the case here. PR-URL: #59828 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
targos
added
the
dont-land-on-v24.x
label
Sep 23, 2025Merged
9 tasks
Merged
nodejs-github-bot pushed a commit that referenced this pull request
Nov 26, 2025targos added a commit that referenced this pull request
Nov 27, 2025aduh95 pushed a commit that referenced this pull request
Jan 9, 2026RafaelGSS pushed a commit that referenced this pull request
Jan 13, 2026