Conversation
|
/cc @digitalinfinity @jasongin @gabrielschulhof Ignore the changes to |
test/index.js
Outdated
There was a problem hiding this comment.
Did you intend to delete the splicing lines above?
src/node_internals.h
Outdated
There was a problem hiding this comment.
Can you put a comment in here explaining that this is not the real, complete "node_internals", but just a shim for building node_api.cc outside of node?
napi-inl.h
Outdated
There was a problem hiding this comment.
Suggestion: wrap this in a do { ... } while so that if (...) NAPI_FATAL_IF_FAILED(...); else ... does the right thing.
src/node_api.cc
Outdated
There was a problem hiding this comment.
Style: indent line continuations by four spaces, not two.
src/node_api.cc
Outdated
There was a problem hiding this comment.
Style: wrapper_template (snake_case, not camelCase, for locals.)
Substance: creating an ObjectTemplate every time leaks memory. V8 caches them internally and it doesn't put an upper bound or a lifetime on elements in the cache. Create a single ObjectTemplate and reuse that.
There was a problem hiding this comment.
Hmm ... we do this upstream as well.
src/node_api.cc
Outdated
There was a problem hiding this comment.
Can you use the Maybe overloads here?
src/node_internals.h
Outdated
There was a problem hiding this comment.
There was a problem hiding this comment.
Thanks @bnoordhuis, I was looking for some guidance here. I'll change the copyright headers.
test/error.js
Outdated
There was a problem hiding this comment.
Style: 4 space indent for line continuations.
V8 caches and does not subsequently release `ObjectTemplate` instances. Thus, we need to store the `ObjectTemplate` from which we derive object instances we use for `napi_wrap()` and function/accessor context in a persistent in the `napi_env`. nodejs/node-addon-api#70 (comment)
V8 caches and does not subsequently release `ObjectTemplate` instances. Thus, we need to store the `ObjectTemplate` from which we derive object instances we use for `napi_wrap()` and function/accessor context in a persistent in the `napi_env`. nodejs/node-addon-api#70 (comment) PR-URL: #13999 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.co> Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com>
V8 caches and does not subsequently release `ObjectTemplate` instances. Thus, we need to store the `ObjectTemplate` from which we derive object instances we use for `napi_wrap()` and function/accessor context in a persistent in the `napi_env`. nodejs/node-addon-api#70 (comment) PR-URL: #13999 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.co> Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com>
|
@kfarnung Is this ready to merge? It looks like you've addressed @bnoordhuis's feedback. |
|
I was waiting on the upstream change (nodejs/node#13971) to land before trying to get this merged. |
|
I guess this now needs to be rebased to remove the changes to the node files. |
|
Yup, I'll take care of that momentarily. |
* Added static method `Error::Fatal` to invoke `napi_fatal_error` * Added `node_internals.cc/h` to shim missing internal functions * Added a test for `Error::Fatal` * Replaced usage of assert with calls to `Error::Fatal`
|
Rebased one last time and new CI run: https://travis-ci.org/kfarnung/node-addon-api/builds/253725282 |
|
Looks like Ben's comments have been addressed so landing. |
* Added static method `Error::Fatal` to invoke `napi_fatal_error` * Added `node_internals.cc/h` to shim missing internal functions * Added a test for `Error::Fatal` * Replaced usage of assert with calls to `Error::Fatal` PR-URL: #70 Reviewed-By: Jason Ginchereau <jasongin@microsoft.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
|
landed as 28fad43 |
V8 caches and does not subsequently release `ObjectTemplate` instances. Thus, we need to store the `ObjectTemplate` from which we derive object instances we use for `napi_wrap()` and function/accessor context in a persistent in the `napi_env`. nodejs/node-addon-api#70 (comment) PR-URL: #13999 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.co> Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com>
V8 caches and does not subsequently release `ObjectTemplate` instances. Thus, we need to store the `ObjectTemplate` from which we derive object instances we use for `napi_wrap()` and function/accessor context in a persistent in the `napi_env`. nodejs/node-addon-api#70 (comment) PR-URL: #13999 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.co> Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com>
V8 caches and does not subsequently release `ObjectTemplate` instances. Thus, we need to store the `ObjectTemplate` from which we derive object instances we use for `napi_wrap()` and function/accessor context in a persistent in the `napi_env`. nodejs/node-addon-api#70 (comment) PR-URL: nodejs#13999 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.co> Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com>
V8 caches and does not subsequently release `ObjectTemplate` instances. Thus, we need to store the `ObjectTemplate` from which we derive object instances we use for `napi_wrap()` and function/accessor context in a persistent in the `napi_env`. nodejs/node-addon-api#70 (comment) Backport-PR-URL: #19447 PR-URL: #13999 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.co> Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com>
* Added static method `Error::Fatal` to invoke `napi_fatal_error` * Added `node_internals.cc/h` to shim missing internal functions * Added a test for `Error::Fatal` * Replaced usage of assert with calls to `Error::Fatal` PR-URL: nodejs/node-addon-api#70 Reviewed-By: Jason Ginchereau <jasongin@microsoft.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* Added static method `Error::Fatal` to invoke `napi_fatal_error` * Added `node_internals.cc/h` to shim missing internal functions * Added a test for `Error::Fatal` * Replaced usage of assert with calls to `Error::Fatal` PR-URL: nodejs/node-addon-api#70 Reviewed-By: Jason Ginchereau <jasongin@microsoft.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* Added static method `Error::Fatal` to invoke `napi_fatal_error` * Added `node_internals.cc/h` to shim missing internal functions * Added a test for `Error::Fatal` * Replaced usage of assert with calls to `Error::Fatal` PR-URL: nodejs/node-addon-api#70 Reviewed-By: Jason Ginchereau <jasongin@microsoft.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* Added static method `Error::Fatal` to invoke `napi_fatal_error` * Added `node_internals.cc/h` to shim missing internal functions * Added a test for `Error::Fatal` * Replaced usage of assert with calls to `Error::Fatal` PR-URL: nodejs/node-addon-api#70 Reviewed-By: Jason Ginchereau <jasongin@microsoft.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Error::Fatalto invokenapi_fatal_errornode_internals.cc/hto shim missing internal functionsError::Fatal