From 9f5cc1fc92918c387ec007944b5a53566b428adb Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 30 Jul 2018 01:34:51 -0700 Subject: src: move process.binding('performance') to internalBinding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/22029 Reviewed-By: Colin Ihrig Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Gus Caplan Reviewed-By: Michaƫl Zasso Reviewed-By: Jon Moss Reviewed-By: Ruben Bridgewater Reviewed-By: Anna Henningsen Reviewed-By: Michael Dawson Reviewed-By: Matteo Collina --- lib/internal/bootstrap/node.js | 2 +- lib/internal/test/binding.js | 7 +------ lib/perf_hooks.js | 3 ++- src/node_perf.cc | 2 +- test/parallel/test-internal-module-wrap.js | 3 ++- test/parallel/test-performance-gc.js | 5 +++-- test/parallel/test-performanceobserver.js | 4 +++- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 016c0c5e230..d46b0308c64 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -84,7 +84,7 @@ workerThreadSetup.setupStdio(); } - const perf = process.binding('performance'); + const perf = internalBinding('performance'); const { NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE, } = perf.constants; diff --git a/lib/internal/test/binding.js b/lib/internal/test/binding.js index f9f018a7822..8c19be8ac0b 100644 --- a/lib/internal/test/binding.js +++ b/lib/internal/test/binding.js @@ -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 }; diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index f7b18816e6c..2e850db8716 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -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, diff --git a/src/node_perf.cc b/src/node_perf.cc index a1ca57e2d5c..5a50223ed59 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -454,4 +454,4 @@ void Initialize(Local target, } // namespace performance } // namespace node -NODE_BUILTIN_MODULE_CONTEXT_AWARE(performance, node::performance::Initialize) +NODE_MODULE_CONTEXT_AWARE_INTERNAL(performance, node::performance::Initialize) diff --git a/test/parallel/test-internal-module-wrap.js b/test/parallel/test-internal-module-wrap.js index 99f1e9d6e70..a1461e34b0d 100644 --- a/test/parallel/test-internal-module-wrap.js +++ b/test/parallel/test-internal-module-wrap.js @@ -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); diff --git a/test/parallel/test-performance-gc.js b/test/parallel/test-performance-gc.js index f4ff88a6378..d071cddbcf0 100644 --- a/test/parallel/test-performance-gc.js +++ b/test/parallel/test-performance-gc.js @@ -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, diff --git a/test/parallel/test-performanceobserver.js b/test/parallel/test-performanceobserver.js index 5d6029fc0d5..06c1281666b 100644 --- a/test/parallel/test-performanceobserver.js +++ b/test/parallel/test-performanceobserver.js @@ -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, -- cgit v1.2.3