src: move process.binding('performance') to internalBinding

PR-URL: https://github.com/nodejs/node/pull/22029
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
James M Snell 2018-07-30 01:34:51 -07:00
parent 4253e5583b
commit 9f5cc1fc92
7 changed files with 13 additions and 13 deletions

View File

@ -84,7 +84,7 @@
workerThreadSetup.setupStdio();
}
const perf = process.binding('performance');
const perf = internalBinding('performance');
const {
NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE,
} = perf.constants;

View File

@ -5,10 +5,5 @@ process.emitWarning(
'tracked by any versioning system or deprecation process.',
'internal/test/binding');
// These exports should be scoped as specifically as possible
// to avoid exposing APIs because even with that warning and
// this file being internal people will still try to abuse it.
const { internalBinding } = require('internal/bootstrap/loaders');
module.exports = {
ModuleWrap: internalBinding('module_wrap').ModuleWrap,
};
module.exports = { internalBinding };

View File

@ -1,5 +1,6 @@
'use strict';
const { internalBinding } = require('internal/bootstrap/loaders');
const {
PerformanceEntry,
mark: _mark,
@ -12,7 +13,7 @@ const {
timeOriginTimestamp,
timerify,
constants
} = process.binding('performance');
} = internalBinding('performance');
const {
NODE_PERFORMANCE_ENTRY_TYPE_NODE,

View File

@ -454,4 +454,4 @@ void Initialize(Local<Object> target,
} // namespace performance
} // namespace node
NODE_BUILTIN_MODULE_CONTEXT_AWARE(performance, node::performance::Initialize)
NODE_MODULE_CONTEXT_AWARE_INTERNAL(performance, node::performance::Initialize)

View File

@ -5,7 +5,8 @@
require('../common');
const assert = require('assert');
const { ModuleWrap } = require('internal/test/binding');
const { internalBinding } = require('internal/test/binding');
const { ModuleWrap } = internalBinding('module_wrap');
const { getPromiseDetails, isPromise } = process.binding('util');
const setTimeoutAsync = require('util').promisify(setTimeout);

View File

@ -4,7 +4,8 @@
const common = require('../common');
const assert = require('assert');
const {
PerformanceObserver
PerformanceObserver,
constants
} = require('perf_hooks');
const {
@ -12,7 +13,7 @@ const {
NODE_PERFORMANCE_GC_MINOR,
NODE_PERFORMANCE_GC_INCREMENTAL,
NODE_PERFORMANCE_GC_WEAKCB
} = process.binding('performance').constants;
} = constants;
const kinds = [
NODE_PERFORMANCE_GC_MAJOR,

View File

@ -1,11 +1,13 @@
// Flags: --expose-internals
'use strict';
const common = require('../common');
const Countdown = require('../common/countdown');
const assert = require('assert');
const { internalBinding } = require('internal/test/binding');
const {
observerCounts: counts
} = process.binding('performance');
} = internalBinding('performance');
const {
performance,
PerformanceObserver,