Skip to content

Commit

Permalink
src: move process.binding('performance') to internalBinding
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jasnell committed Aug 9, 2018
1 parent 4253e55 commit 9f5cc1f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
workerThreadSetup.setupStdio();
}

const perf = process.binding('performance');
const perf = internalBinding('performance');
const {
NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE,
} = perf.constants;
Expand Down
7 changes: 1 addition & 6 deletions lib/internal/test/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
3 changes: 2 additions & 1 deletion lib/perf_hooks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

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

const {
NODE_PERFORMANCE_ENTRY_TYPE_NODE,
Expand Down
2 changes: 1 addition & 1 deletion src/node_perf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 2 additions & 1 deletion test/parallel/test-internal-module-wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-performance-gc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
const common = require('../common');
const assert = require('assert');
const {
PerformanceObserver
PerformanceObserver,
constants
} = require('perf_hooks');

const {
NODE_PERFORMANCE_GC_MAJOR,
NODE_PERFORMANCE_GC_MINOR,
NODE_PERFORMANCE_GC_INCREMENTAL,
NODE_PERFORMANCE_GC_WEAKCB
} = process.binding('performance').constants;
} = constants;

const kinds = [
NODE_PERFORMANCE_GC_MAJOR,
Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-performanceobserver.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit 9f5cc1f

Please sign in to comment.