| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 72f1463 commit 4f30c21
19 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | // Show the difference between calling a V8 binding C++ function | |
| 2 | - // relative to a comparable N-API C++ function, | ||
| 2 | + // relative to a comparable Node-API C++ function, | ||
| 3 | 3 | // in various types/numbers of arguments. | |
| 4 | 4 | // Reports n of calls per second. | |
| 5 | 5 | 'use strict'; | |
@@ -19,7 +19,7 @@ try { | |||
| 19 | 19 | try { | |
| 20 | 20 | napi = require(`./build/${common.buildType}/napi_binding`); | |
| 21 | 21 | } catch { | |
| 22 | - console.error(`${__filename}: NAPI-Binding failed to load`); | ||
| 22 | + console.error(`${__filename}: Node-API binding failed to load`); | ||
| 23 | 23 | process.exit(0); | |
| 24 | 24 | } | |
| 25 | 25 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ let napi_binding; | |||
| 24 | 24 | try { | |
| 25 | 25 | napi_binding = require(`./build/${common.buildType}/napi_binding`); | |
| 26 | 26 | } catch { | |
| 27 | - console.error('misc/function_call/index.js NAPI-Binding failed to load'); | ||
| 27 | + console.error('misc/function_call/index.js Node-API binding failed to load'); | ||
| 28 | 28 | process.exit(0); | |
| 29 | 29 | } | |
| 30 | 30 | const napi = napi_binding.hello; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,12 +7,11 @@ | |||
| 7 | 7 | #ifdef NAPI_EXPERIMENTAL | |
| 8 | 8 | #define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL | |
| 9 | 9 | #else | |
| 10 | - // The baseline version for N-API. | ||
| 11 | - // The NAPI_VERSION controls which version will be used by default when | ||
| 12 | - // compilling a native addon. If the addon developer specifically wants to use | ||
| 13 | - // functions available in a new version of N-API that is not yet ported in all | ||
| 14 | - // LTS versions, they can set NAPI_VERSION knowing that they have specifically | ||
| 15 | - // depended on that version. | ||
| 10 | + // The baseline version for Node-API. | ||
| 11 | + // NAPI_VERSION controls which version is used by default when compiling | ||
| 12 | + // a native addon. If the addon developer wants to use functions from a | ||
| 13 | + // newer Node-API version not yet available in all LTS versions, they can | ||
| 14 | + // set NAPI_VERSION to explicitly depend on that version. | ||
| 16 | 15 | #define NAPI_VERSION 8 | |
| 17 | 16 | #endif | |
| 18 | 17 | #endif | |
@@ -31,7 +30,7 @@ | |||
| 31 | 30 | ||
| 32 | 31 | // This file needs to be compatible with C compilers. | |
| 33 | 32 | // This is a public include file, and these includes have essentially | |
| 34 | - // became part of it's API. | ||
| 33 | + // become part of its API. | ||
| 35 | 34 | #include <stddef.h> // NOLINT(modernize-deprecated-headers) | |
| 36 | 35 | #include <stdint.h> // NOLINT(modernize-deprecated-headers) | |
| 37 | 36 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,7 @@ | |||
| 18 | 18 | #define CHECK_TO_NUMBER(env, context, result, src) \ | |
| 19 | 19 | CHECK_TO_TYPE((env), Number, (context), (result), (src), napi_number_expected) | |
| 20 | 20 | ||
| 21 | - // n-api defines NAPI_AUTO_LENGTH as the indicator that a string | ||
| 21 | + // Node-API defines NAPI_AUTO_LENGTH as the indicator that a string | ||
| 22 | 22 | // is null terminated. For V8 the equivalent is -1. The assert | |
| 23 | 23 | // validates that our cast of NAPI_AUTO_LENGTH results in -1 as | |
| 24 | 24 | // needed by V8. | |
@@ -225,7 +225,7 @@ inline napi_status V8NameFromPropertyDescriptor( | |||
| 225 | 225 | return napi_ok; | |
| 226 | 226 | } | |
| 227 | 227 | ||
| 228 | - // convert from n-api property attributes to v8::PropertyAttribute | ||
| 228 | + // convert from Node-API property attributes to v8::PropertyAttribute | ||
| 229 | 229 | inline v8::PropertyAttribute V8PropertyAttributesFromDescriptor( | |
| 230 | 230 | const napi_property_descriptor* descriptor) { | |
| 231 | 231 | unsigned int attribute_flags = v8::PropertyAttribute::None; | |
@@ -378,11 +378,10 @@ inline napi_status Unwrap(napi_env env, | |||
| 378 | 378 | ||
| 379 | 379 | //=== Function napi_callback wrapper ================================= | |
| 380 | 380 | ||
| 381 | - // Use this data structure to associate callback data with each N-API function | ||
| 382 | - // exposed to JavaScript. The structure is stored in a v8::External which gets | ||
| 383 | - // passed into our callback wrapper. This reduces the performance impact of | ||
| 384 | - // calling through N-API. | ||
| 385 | - // Ref: benchmark/misc/function_call | ||
| 381 | + // Use this data structure to associate callback data with each Node-API | ||
| 382 | + // function exposed to JavaScript. The structure is stored in a v8::External | ||
| 383 | + // which gets passed into our callback wrapper. This reduces the performance | ||
| 384 | + // impact of calling through Node-API. Ref: benchmark/misc/function_call | ||
| 386 | 385 | // Discussion (incl. perf. data): https://github.com/nodejs/node/pull/21072 | |
| 387 | 386 | class CallbackBundle { | |
| 388 | 387 | public: | |
@@ -407,7 +406,7 @@ class CallbackBundle { | |||
| 407 | 406 | } | |
| 408 | 407 | ||
| 409 | 408 | public: | |
| 410 | - napi_env env; // Necessary to invoke C++ NAPI callback | ||
| 409 | + napi_env env; // Necessary to invoke C++ Node-API callback | ||
| 411 | 410 | void* cb_data; // The user provided callback data | |
| 412 | 411 | napi_callback cb; | |
| 413 | 412 | ||
@@ -2126,7 +2125,7 @@ napi_status NAPI_CDECL napi_get_null(napi_env env, napi_value* result) { | |||
| 2126 | 2125 | ||
| 2127 | 2126 | // Gets all callback info in a single call. (Ugly, but faster.) | |
| 2128 | 2127 | napi_status NAPI_CDECL napi_get_cb_info( | |
| 2129 | - napi_env env, // [in] NAPI environment handle | ||
| 2128 | + napi_env env, // [in] Node-API environment handle | ||
| 2130 | 2129 | napi_callback_info cbinfo, // [in] Opaque callback-info handle | |
| 2131 | 2130 | size_t* argc, // [in-out] Specifies the size of the provided argv array | |
| 2132 | 2131 | // and receives the actual count of args. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,14 @@ | |||
| 1 | 1 | #ifndef SRC_JS_NATIVE_API_V8_INTERNALS_H_ | |
| 2 | 2 | #define SRC_JS_NATIVE_API_V8_INTERNALS_H_ | |
| 3 | 3 | ||
| 4 | - // The V8 implementation of N-API, including `js_native_api_v8.h` uses certain | ||
| 5 | - // idioms which require definition here. For example, it uses a variant of | ||
| 6 | - // persistent references which need not be reset in the constructor. It is the | ||
| 7 | - // responsibility of this file to define these idioms. Optionally, this file | ||
| 8 | - // may also define `NAPI_VERSION` and set it to the version of N-API to be | ||
| 4 | + // The V8 implementation of Node-API, including `js_native_api_v8.h` uses | ||
| 5 | + // certain idioms which require definition here. For example, it uses a variant | ||
| 6 | + // of persistent references which need not be reset in the constructor. It is | ||
| 7 | + // the responsibility of this file to define these idioms. Optionally, this file | ||
| 8 | + // may also define `NAPI_VERSION` and set it to the version of Node-API to be | ||
| 9 | 9 | // exposed. | |
| 10 | 10 | ||
| 11 | - // In the case of the Node.js implementation of N-API some of the idioms are | ||
| 11 | + // In the case of the Node.js implementation of Node-API some of the idioms are | ||
| 12 | 12 | // imported directly from Node.js by including `node_internals.h` below. Others | |
| 13 | 13 | // are bridged to remove references to the `node` namespace. `node_version.h`, | |
| 14 | 14 | // included below, defines `NAPI_VERSION`. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,10 +56,10 @@ static void ThrowNodeApiVersionError(node::Environment* node_env, | |||
| 56 | 56 | result = new node_napi_env__(context, module_filename, module_api_version); | |
| 57 | 57 | // TODO(addaleax): There was previously code that tried to delete the | |
| 58 | 58 | // napi_env when its v8::Context was garbage collected; | |
| 59 | - // However, as long as N-API addons using this napi_env are in place, | ||
| 59 | + // However, as long as Node-API addons using this napi_env are in place, | ||
| 60 | 60 | // the Context needs to be accessible and alive. | |
| 61 | 61 | // Ideally, we'd want an on-addon-unload hook that takes care of this | |
| 62 | - // once all N-API addons using this napi_env are unloaded. | ||
| 62 | + // once all Node-API addons using this napi_env are unloaded. | ||
| 63 | 63 | // For now, a per-Environment cleanup hook is the best we can do. | |
| 64 | 64 | result->node_env()->AddCleanupHook( | |
| 65 | 65 | [](void* arg) { static_cast<napi_env>(arg)->Unref(); }, | |
@@ -150,7 +150,7 @@ void node_napi_env__::CallbackIntoModule(T&& call) { | |||
| 150 | 150 | !enforceUncaughtExceptionPolicy) { | |
| 151 | 151 | ProcessEmitDeprecationWarning( | |
| 152 | 152 | node_env, | |
| 153 | - "Uncaught N-API callback exception detected, please run node " | ||
| 153 | + "Uncaught Node-API callback exception detected, please run node " | ||
| 154 | 154 | "with option --force-node-api-uncaught-exceptions-policy=true " | |
| 155 | 155 | "to handle those exceptions properly.", | |
| 156 | 156 | "DEP0168"); | |
@@ -675,8 +675,8 @@ class AsyncContext { | |||
| 675 | 675 | } // end of namespace v8impl | |
| 676 | 676 | ||
| 677 | 677 | // Intercepts the Node-V8 module registration callback. Converts parameters | |
| 678 | - // to NAPI equivalents and then calls the registration callback specified | ||
| 679 | - // by the NAPI module. | ||
| 678 | + // to Node-API equivalents and then calls the registration callback specified | ||
| 679 | + // by the Node-API module. | ||
| 680 | 680 | static void napi_module_register_cb(v8::Local<v8::Object> exports, | |
| 681 | 681 | v8::Local<v8::Value> module, | |
| 682 | 682 | v8::Local<v8::Context> context, | |
@@ -796,7 +796,7 @@ node_module napi_module_to_node_module(const napi_module* mod) { | |||
| 796 | 796 | } | |
| 797 | 797 | } // namespace node | |
| 798 | 798 | ||
| 799 | - // Registers a NAPI module. | ||
| 799 | + // Registers a Node-API module. | ||
| 800 | 800 | void NAPI_CDECL napi_module_register(napi_module* mod) { | |
| 801 | 801 | node::node_module* nm = | |
| 802 | 802 | new node::node_module(node::napi_module_to_node_module(mod)); | |
@@ -839,7 +839,7 @@ struct napi_async_cleanup_hook_handle__ { | |||
| 839 | 839 | if (done_cb_ != nullptr) done_cb_(done_data_); | |
| 840 | 840 | ||
| 841 | 841 | // Release the `env` handle asynchronously since it would be surprising if | |
| 842 | - // a call to a N-API function would destroy `env` synchronously. | ||
| 842 | + // a call to a Node-API function would destroy `env` synchronously. | ||
| 843 | 843 | static_cast<node_napi_env>(env_)->node_env()->SetImmediate( | |
| 844 | 844 | [env = env_](node::Environment*) { env->Unref(); }); | |
| 845 | 845 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -526,7 +526,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) { | |||
| 526 | 526 | } | |
| 527 | 527 | } | |
| 528 | 528 | ||
| 529 | - // -1 is used for N-API modules | ||
| 529 | + // -1 is used for Node-API modules | ||
| 530 | 530 | if ((mp->nm_version != -1) && (mp->nm_version != NODE_MODULE_VERSION)) { | |
| 531 | 531 | // Even if the module did self-register, it may have done so with the | |
| 532 | 532 | // wrong version. We must only give up after having checked to see if it | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | const common = require('../common'); | |
| 4 | 4 | ||
| 5 | 5 | if (common.isWindows) { | |
| 6 | - common.skip('vcbuild.bat doesn\'t build the n-api benchmarks yet'); | ||
| 6 | + common.skip('vcbuild.bat doesn\'t build the Node-API benchmarks yet'); | ||
| 7 | 7 | } | |
| 8 | 8 | ||
| 9 | 9 | const { isMainThread } = require('worker_threads'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -348,7 +348,8 @@ TEST_F(LinkedBindingTest, ManyBindingsTest) { | |||
| 348 | 348 | AddLinkedBinding(*test_env, "local_linked1", InitializeLocalBinding, &calls); | |
| 349 | 349 | AddLinkedBinding(*test_env, "local_linked2", InitializeLocalBinding, &calls); | |
| 350 | 350 | AddLinkedBinding(*test_env, "local_linked3", InitializeLocalBinding, &calls); | |
| 351 | - AddLinkedBinding(*test_env, local_linked_napi); // Add a N-API addon as well. | ||
| 351 | + AddLinkedBinding(*test_env, | ||
| 352 | + local_linked_napi); // Add a Node-API addon as well. | ||
| 352 | 353 | AddLinkedBinding(*test_env, "local_linked4", InitializeLocalBinding, &calls); | |
| 353 | 354 | AddLinkedBinding(*test_env, "local_linked5", InitializeLocalBinding, &calls); | |
| 354 | 355 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | const common = require('../../common'); | |
| 3 | 3 | const assert = require('assert'); | |
| 4 | 4 | ||
| 5 | - // Test passing NULL to object-related N-APIs. | ||
| 5 | + // Test passing NULL to object-related Node-APIs. | ||
| 6 | 6 | const { testNull } = require(`./build/${common.buildType}/test_constructor`); | |
| 7 | 7 | const expectedResult = { | |
| 8 | 8 | envIsNull: 'Invalid argument', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments