Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! fixup! fixup! fixup! fixup! src: make BuiltinLoader threadsafe…
… and non-global
  • Loading branch information
addaleax committed Jan 17, 2023
commit ed986f9a84ea04b70abf741d59cd3a0f0759b60c
7 changes: 6 additions & 1 deletion src/api/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,12 @@ Maybe<bool> InitializePrimordials(Local<Context> context) {
"internal/per_context/messageport",
nullptr};

auto builtin_loader = builtins::BuiltinLoader::Create();
// We do not have access to a per-Environment BuiltinLoader instance
// at this point, because this code runs before an Environment exists
// in the first place. However, creating BuiltinLoader instances is
// relatively cheap and all the scripts that we may want to run at
// startup are always present in it.
thread_local auto builtin_loader = builtins::BuiltinLoader::Create();
for (const char** module = context_files; *module != nullptr; module++) {
Local<Value> arguments[] = {exports, primordials};
if (builtin_loader
Expand Down
1 change: 0 additions & 1 deletion src/node_builtins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@ void BuiltinLoader::GetBuiltinCategories(
Local<Context> context = env->context();
Local<Object> result = Object::New(isolate);

// Copy from the per-process categories
std::set<std::string> cannot_be_required =
env->builtin_loader()->GetCannotBeRequired();
std::set<std::string> can_be_required =
Expand Down