Skip to content

Commit f7cf9b6

Browse files
committed
rename to
1 parent 330bd1d commit f7cf9b6

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

lib/internal/modules/esm/hooks.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ class HooksProxy {
494494
*/
495495
#lock;
496496
/**
497-
* The InternalWorker instance, which lets us communicate with the loader thread.
497+
* The HooksWorker instance, which lets us communicate with the loader thread.
498498
*/
499499
#worker;
500500

@@ -518,7 +518,7 @@ class HooksProxy {
518518
#isWorkerOwner = false;
519519

520520
constructor() {
521-
const { InternalWorker, hooksPort } = require('internal/worker');
521+
const { HooksWorker, hooksPort } = require('internal/worker');
522522
const lock = new SharedArrayBuffer(SHARED_MEMORY_BYTE_LENGTH);
523523
this.#lock = new Int32Array(lock);
524524

@@ -527,7 +527,7 @@ class HooksProxy {
527527
// the existing instance. If another thread created it, the constructor will throw
528528
// Fallback is to use the existing hooksPort created by the thread that originally
529529
// spawned the customization hooks thread.
530-
this.#worker = new InternalWorker(loaderWorkerId, {
530+
this.#worker = new HooksWorker(loaderWorkerId, {
531531
stderr: false,
532532
stdin: false,
533533
stdout: false,
@@ -551,10 +551,10 @@ class HooksProxy {
551551

552552
waitForWorker() {
553553
// There is one Hooks instance for each worker thread. But only one of
554-
// these Hooks instances has an InternalWorker. That was the Hooks instance
554+
// these Hooks instances has a HooksWorker. That was the Hooks instance
555555
// created for the first thread that registers a hook set.
556556
// It means for all Hooks instances that are not on that thread => they are
557-
// done because they delegate to the single InternalWorker.
557+
// done because they delegate to the single HooksWorker.
558558
if (!this.#isWorkerOwner) {
559559
return;
560560
}

lib/internal/worker.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,10 @@ class Worker extends EventEmitter {
482482
}
483483

484484
/**
485-
* A worker which has an internal module for entry point (e.g. internal/module/esm/worker).
486-
* Internal workers bypass the permission model.
485+
* A worker which is used to by the customization hooks thread (internal/module/esm/worker).
486+
* This bypasses the permission model.
487487
*/
488-
class InternalWorker extends Worker {
488+
class HooksWorker extends Worker {
489489
constructor(filename, options) {
490490
super(filename, options, kIsInternal);
491491
}
@@ -570,6 +570,6 @@ module.exports = {
570570
getEnvironmentData,
571571
assignEnvironmentData,
572572
threadId,
573-
InternalWorker,
573+
HooksWorker,
574574
Worker,
575575
};

src/node_worker.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace node {
4646
namespace worker {
4747

4848
constexpr double kMB = 1024 * 1024;
49-
std::atomic_bool Worker::internalExists{false};
49+
std::atomic_bool Worker::hooksWorkerExists{false};
5050
Mutex Worker::instantiationMutex;
5151

5252
Worker::Worker(Environment* env,
@@ -498,14 +498,14 @@ void Worker::New(const FunctionCallbackInfo<Value>& args) {
498498
CHECK(args.IsConstructCall());
499499
auto creatingHooksThread = is_internal->IsTrue();
500500

501-
if (creatingHooksThread && internalExists) {
501+
if (creatingHooksThread && hooksWorkerExists) {
502502
isolate->ThrowException(ERR_HOOKS_THREAD_EXISTS(
503503
isolate, "Customization hooks thread already exists"));
504504
return;
505505
}
506506

507507
if (creatingHooksThread) {
508-
internalExists = true;
508+
hooksWorkerExists = true;
509509
}
510510

511511
if (env->isolate_data()->platform() == nullptr) {
@@ -918,7 +918,7 @@ void Worker::LoopStartTime(const FunctionCallbackInfo<Value>& args) {
918918
}
919919

920920
void Worker::HasHooksThread(const FunctionCallbackInfo<Value>& args) {
921-
args.GetReturnValue().Set(Worker::internalExists);
921+
args.GetReturnValue().Set(Worker::hooksWorkerExists);
922922
}
923923

924924
namespace {

src/node_worker.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Worker : public AsyncWrap {
104104
uintptr_t stack_base_ = 0;
105105
// Optional name used for debugging in inspector and trace events.
106106
std::string name_;
107-
static std::atomic_bool internalExists;
107+
static std::atomic_bool hooksWorkerExists;
108108
// this mutex is to synchronize ::New calls
109109
static Mutex instantiationMutex;
110110

0 commit comments

Comments
 (0)