src: move process.binding('async_wrap') internal
This commit makes the async_wrap builtin an internal builtin, and changes usage of the builtin from using process.binding('async_wrap') to use internalBinding instead. Refs: https://github.com/nodejs/node/issues/22160 PR-URL: https://github.com/nodejs/node/pull/22469 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
49bfc37241
commit
da8641f3b4
@ -4,7 +4,8 @@ const {
|
|||||||
ERR_ASYNC_TYPE,
|
ERR_ASYNC_TYPE,
|
||||||
ERR_INVALID_ASYNC_ID
|
ERR_INVALID_ASYNC_ID
|
||||||
} = require('internal/errors').codes;
|
} = require('internal/errors').codes;
|
||||||
const async_wrap = process.binding('async_wrap');
|
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||||
|
const async_wrap = internalBinding('async_wrap');
|
||||||
/* async_hook_fields is a Uint32Array wrapping the uint32_t array of
|
/* async_hook_fields is a Uint32Array wrapping the uint32_t array of
|
||||||
* Environment::AsyncHooks::fields_[]. Each index tracks the number of active
|
* Environment::AsyncHooks::fields_[]. Each index tracks the number of active
|
||||||
* hooks for each type.
|
* hooks for each type.
|
||||||
|
@ -356,7 +356,8 @@
|
|||||||
'crypto',
|
'crypto',
|
||||||
'contextify',
|
'contextify',
|
||||||
'tcp_wrap',
|
'tcp_wrap',
|
||||||
'tls_wrap']);
|
'tls_wrap',
|
||||||
|
'async_wrap']);
|
||||||
process.binding = function binding(name) {
|
process.binding = function binding(name) {
|
||||||
return internalBindingWhitelist.has(name) ?
|
return internalBindingWhitelist.has(name) ?
|
||||||
internalBinding(name) :
|
internalBinding(name) :
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { AsyncWrap, Providers } = process.binding('async_wrap');
|
|
||||||
const { Buffer } = require('buffer');
|
|
||||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||||
|
const { AsyncWrap, Providers } = internalBinding('async_wrap');
|
||||||
|
const { Buffer } = require('buffer');
|
||||||
const { INT_MAX, pbkdf2: _pbkdf2 } = internalBinding('crypto');
|
const { INT_MAX, pbkdf2: _pbkdf2 } = internalBinding('crypto');
|
||||||
const { validateInt32 } = require('internal/validators');
|
const { validateInt32 } = require('internal/validators');
|
||||||
const {
|
const {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { AsyncWrap, Providers } = process.binding('async_wrap');
|
|
||||||
const { Buffer, kMaxLength } = require('buffer');
|
|
||||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||||
|
const { AsyncWrap, Providers } = internalBinding('async_wrap');
|
||||||
|
const { Buffer, kMaxLength } = require('buffer');
|
||||||
const { randomBytes: _randomBytes } = internalBinding('crypto');
|
const { randomBytes: _randomBytes } = internalBinding('crypto');
|
||||||
const {
|
const {
|
||||||
ERR_INVALID_ARG_TYPE,
|
ERR_INVALID_ARG_TYPE,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { AsyncWrap, Providers } = process.binding('async_wrap');
|
|
||||||
const { Buffer } = require('buffer');
|
|
||||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||||
|
const { AsyncWrap, Providers } = internalBinding('async_wrap');
|
||||||
|
const { Buffer } = require('buffer');
|
||||||
const { INT_MAX, scrypt: _scrypt } = internalBinding('crypto');
|
const { INT_MAX, scrypt: _scrypt } = internalBinding('crypto');
|
||||||
const { validateInt32 } = require('internal/validators');
|
const { validateInt32 } = require('internal/validators');
|
||||||
const {
|
const {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||||
const { trace } = internalBinding('trace_events');
|
const { trace } = internalBinding('trace_events');
|
||||||
const async_wrap = process.binding('async_wrap');
|
const async_wrap = internalBinding('async_wrap');
|
||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
const { SafeMap, SafeSet } = require('internal/safe_globals');
|
const { SafeMap, SafeSet } = require('internal/safe_globals');
|
||||||
|
|
||||||
|
@ -765,4 +765,4 @@ Local<Object> AsyncWrap::GetOwner(Environment* env, Local<Object> obj) {
|
|||||||
|
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
|
||||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(async_wrap, node::AsyncWrap::Initialize)
|
NODE_MODULE_CONTEXT_AWARE_INTERNAL(async_wrap, node::AsyncWrap::Initialize)
|
||||||
|
@ -79,7 +79,8 @@ if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) {
|
|||||||
const destroydIdsList = {};
|
const destroydIdsList = {};
|
||||||
const destroyListList = {};
|
const destroyListList = {};
|
||||||
const initHandles = {};
|
const initHandles = {};
|
||||||
const async_wrap = process.binding('async_wrap');
|
const { internalBinding } = require('internal/test/binding');
|
||||||
|
const async_wrap = internalBinding('async_wrap');
|
||||||
|
|
||||||
process.on('exit', () => {
|
process.on('exit', () => {
|
||||||
// iterate through handles to make sure nothing crashes
|
// iterate through handles to make sure nothing crashes
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
// Flags: --expose-internals
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const async_wrap = process.binding('async_wrap');
|
const { internalBinding } = require('internal/test/binding');
|
||||||
|
const async_wrap = internalBinding('async_wrap');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
const RUNS = 5;
|
const RUNS = 5;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// Flags: --expose-internals --no-warnings
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// see also test/sequential/test-async-wrap-getasyncid.js
|
// see also test/sequential/test-async-wrap-getasyncid.js
|
||||||
@ -5,7 +6,8 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const tty_wrap = process.binding('tty_wrap');
|
const tty_wrap = process.binding('tty_wrap');
|
||||||
const { TTYWRAP } = process.binding('async_wrap').Providers;
|
const { internalBinding } = require('internal/test/binding');
|
||||||
|
const { TTYWRAP } = internalBinding('async_wrap').Providers;
|
||||||
const providers = { TTYWRAP };
|
const providers = { TTYWRAP };
|
||||||
|
|
||||||
// Make sure that the TTYWRAP Provider is tested.
|
// Make sure that the TTYWRAP Provider is tested.
|
||||||
|
@ -7,7 +7,7 @@ const assert = require('assert');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const fsPromises = fs.promises;
|
const fsPromises = fs.promises;
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
const providers = Object.assign({}, process.binding('async_wrap').Providers);
|
const providers = Object.assign({}, internalBinding('async_wrap').Providers);
|
||||||
const fixtures = require('../common/fixtures');
|
const fixtures = require('../common/fixtures');
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
const { getSystemErrorName } = require('util');
|
const { getSystemErrorName } = require('util');
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
|
// Flags: --expose-internals
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
common.skipIfInspectorDisabled();
|
common.skipIfInspectorDisabled();
|
||||||
common.skipIf32Bits();
|
common.skipIf32Bits();
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const async_wrap = process.binding('async_wrap');
|
const { internalBinding } = require('internal/test/binding');
|
||||||
|
const async_wrap = internalBinding('async_wrap');
|
||||||
const { kTotals } = async_wrap.constants;
|
const { kTotals } = async_wrap.constants;
|
||||||
const inspector = require('inspector');
|
const inspector = require('inspector');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user