-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v10.x]: Backport instance data #30537
[v10.x]: Backport instance data #30537
Conversation
Needed for nodejs/node-addon-api#567 |
@gabrielf I assume the commit did not apply cleanly. Can you identify the parts you had to update in order to limit what we need to review? |
@mhdawson the separation of js_native_api from node_api is not present in this version, so backporting is not straight-forward. The |
c15919b
to
6911a3f
Compare
Rebased. |
6911a3f
to
e73f742
Compare
Rebased again. |
e73f742
to
24eb78b
Compare
Rebased again. |
99915bc
to
8f3b8ca
Compare
These do not need to be macros. PR-URL: nodejs#26128 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Adds `napi_set_instance_data()` and `napi_get_instance_data()`, which allow native addons to store their data on and retrieve their data from `napi_env`. `napi_set_instance_data()` accepts a finalizer which is called when the `node::Environment()` is destroyed. This entails rendering the `napi_env` local to each add-on. Fixes: nodejs/abi-stable-node#378 PR-URL: nodejs#28682 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
24eb78b
to
dc7d5fd
Compare
@BethGriggs can we get this into v10.x before it goes into maintenance? |
@gabrielschulhof, yes - we're aiming to have one more |
@BethGriggs is this still on track to land? |
@gabrielschulhof yes, but I'm unsure on the timing of the release (nodejs/Release#504 needs updating). |
Possibly will not get a green CI on this until #31887 lands (@AshCripps and I are currently working on backporting the appropriate flaky test markers from v12.x) |
This comment has been minimized.
This comment has been minimized.
CI: https://ci.nodejs.org/job/node-test-pull-request/29347/ ✅ (Known flake) |
Adds `napi_set_instance_data()` and `napi_get_instance_data()`, which allow native addons to store their data on and retrieve their data from `napi_env`. `napi_set_instance_data()` accepts a finalizer which is called when the `node::Environment()` is destroyed. This entails rendering the `napi_env` local to each add-on. Fixes: nodejs/abi-stable-node#378 PR-URL: #28682 Backport-PR-URL: #30537 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Landed in 3f9cec3...f29fb14 |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes