Skip to content

Commit 9f5cc1f

Browse files
committed
src: move process.binding('performance') to internalBinding
PR-URL: #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>
1 parent 4253e55 commit 9f5cc1f

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

lib/internal/bootstrap/node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
workerThreadSetup.setupStdio();
8585
}
8686

87-
const perf = process.binding('performance');
87+
const perf = internalBinding('performance');
8888
const {
8989
NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE,
9090
} = perf.constants;

lib/internal/test/binding.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@ process.emitWarning(
55
'tracked by any versioning system or deprecation process.',
66
'internal/test/binding');
77

8-
// These exports should be scoped as specifically as possible
9-
// to avoid exposing APIs because even with that warning and
10-
// this file being internal people will still try to abuse it.
118
const { internalBinding } = require('internal/bootstrap/loaders');
12-
module.exports = {
13-
ModuleWrap: internalBinding('module_wrap').ModuleWrap,
14-
};
9+
module.exports = { internalBinding };

lib/perf_hooks.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const { internalBinding } = require('internal/bootstrap/loaders');
34
const {
45
PerformanceEntry,
56
mark: _mark,
@@ -12,7 +13,7 @@ const {
1213
timeOriginTimestamp,
1314
timerify,
1415
constants
15-
} = process.binding('performance');
16+
} = internalBinding('performance');
1617

1718
const {
1819
NODE_PERFORMANCE_ENTRY_TYPE_NODE,

src/node_perf.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,4 +454,4 @@ void Initialize(Local<Object> target,
454454
} // namespace performance
455455
} // namespace node
456456

457-
NODE_BUILTIN_MODULE_CONTEXT_AWARE(performance, node::performance::Initialize)
457+
NODE_MODULE_CONTEXT_AWARE_INTERNAL(performance, node::performance::Initialize)

test/parallel/test-internal-module-wrap.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
require('../common');
66
const assert = require('assert');
77

8-
const { ModuleWrap } = require('internal/test/binding');
8+
const { internalBinding } = require('internal/test/binding');
9+
const { ModuleWrap } = internalBinding('module_wrap');
910
const { getPromiseDetails, isPromise } = process.binding('util');
1011
const setTimeoutAsync = require('util').promisify(setTimeout);
1112

test/parallel/test-performance-gc.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
const common = require('../common');
55
const assert = require('assert');
66
const {
7-
PerformanceObserver
7+
PerformanceObserver,
8+
constants
89
} = require('perf_hooks');
910

1011
const {
1112
NODE_PERFORMANCE_GC_MAJOR,
1213
NODE_PERFORMANCE_GC_MINOR,
1314
NODE_PERFORMANCE_GC_INCREMENTAL,
1415
NODE_PERFORMANCE_GC_WEAKCB
15-
} = process.binding('performance').constants;
16+
} = constants;
1617

1718
const kinds = [
1819
NODE_PERFORMANCE_GC_MAJOR,

test/parallel/test-performanceobserver.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
// Flags: --expose-internals
12
'use strict';
23

34
const common = require('../common');
45
const Countdown = require('../common/countdown');
56
const assert = require('assert');
7+
const { internalBinding } = require('internal/test/binding');
68
const {
79
observerCounts: counts
8-
} = process.binding('performance');
10+
} = internalBinding('performance');
911
const {
1012
performance,
1113
PerformanceObserver,

0 commit comments

Comments
 (0)