3 Commits
Author SHA1 Message Date
Gabriel Schulhofandlegendecas e9c590ea00 n-api: define release 6
Mark all N-APIs that have been added since version 5 as stable.

PR-URL: https://github.com/nodejs/node/pull/32058
Backport-PR-URL: https://github.com/nodejs/node/pull/32488
Fixes: https://github.com/nodejs/abi-stable-node/issues/393
Co-Authored-By: legendecas <legendecas@gmail.com>
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2020-04-06 11:39:06 +01:00
Gabriel Schulhof 239377b654 n-api: correct instance data tests
When instance data was backported, some of the tests ended up in a
location where they do not get run. This moves the tests into
test/addons-napi, merging them with existing tests therein, thereby
ensuring that they do get run.

PR-URL: https://github.com/nodejs/node/pull/32488
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2020-04-06 11:37:29 +01:00
Gabriel Schulhof f29fb14cf6 n-api: add APIs for per-instance state management
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: https://github.com/nodejs/abi-stable-node/issues/378
PR-URL: https://github.com/nodejs/node/pull/28682
Backport-PR-URL: https://github.com/nodejs/node/pull/30537
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2020-02-25 19:20:38 +00:00