Skip to content
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.

Commit

Permalink
[squash] make worker/messaging bindings internal
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Oct 22, 2017
1 parent c95eb55 commit 19168e9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/internal/bootstrap_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

(function(process) {
let internalBinding;
const isMainThread = process.binding('worker').threadId === 0;
let isMainThread;

function startup() {
const EventEmitter = NativeModule.require('events');
Expand All @@ -25,6 +25,8 @@
internalBinding = process._internalBinding;
delete process._internalBinding;

isMainThread = internalBinding('worker').threadId === 0;

// do this good and early, since it handles errors.
setupProcessFatal();

Expand Down Expand Up @@ -111,7 +113,7 @@
// are running from a script and running the REPL - but there are a few
// others like the debugger or running --eval arguments. Here we decide
// which mode we run in.
if (process.binding('worker').getEnvMessagePort() !== undefined) {
if (internalBinding('worker').getEnvMessagePort() !== undefined) {
// This means we are in a Worker context, and any script execution
// will be directed by the worker module.
NativeModule.require('internal/worker').setupChild(evalScript);
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const path = require('path');
const util = require('util');
const errors = require('internal/errors');

const { MessagePort, MessageChannel } = process.binding('messaging');
const { MessagePort, MessageChannel } = internalBinding('messaging');
util.inherits(MessagePort, EventEmitter);

const {
Expand All @@ -20,7 +20,7 @@ const {
MESSAGE_FLAG_COULD_NOT_SERIALIZE_ERR,
MESSAGE_FLAG_OUT_OF_MEMORY,
MESSAGE_FLAG_ERROR_MESSAGE
} = process.binding('worker');
} = internalBinding('worker');

setSerializeWorkerErrorFunction(serializeError);
const kHandle = Symbol('kHandle');
Expand Down
2 changes: 1 addition & 1 deletion src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -698,4 +698,4 @@ static void InitMessaging(Local<Object> target,
} // namespace worker
} // namespace node

NODE_MODULE_CONTEXT_AWARE_BUILTIN(messaging, node::worker::InitMessaging)
NODE_MODULE_CONTEXT_AWARE_INTERNAL(messaging, node::worker::InitMessaging)
2 changes: 1 addition & 1 deletion src/node_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,4 @@ void InitWorker(Local<Object> target,
} // namespace worker
} // namespace node

NODE_MODULE_CONTEXT_AWARE_BUILTIN(worker, node::worker::InitWorker)
NODE_MODULE_CONTEXT_AWARE_INTERNAL(worker, node::worker::InitWorker)

0 comments on commit 19168e9

Please sign in to comment.