Skip to content

Commit 19dd7e5

Browse files
committed
src: make BuiltinLoader threadsafe and non-global
nodejs/node#45942
1 parent 4c11999 commit 19dd7e5

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

patches/node/fix_expose_lookupandcompile_with_parameters.patch

+13-12
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ parameters.
1010
This should be upstreamed.
1111

1212
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
13-
index 4d4b59916bfdb203702c4e878ff2659b79de8c52..6451464c9fb411a1988bada86eabb4071ee07eb0 100644
13+
index 7e4a43a6f13845c8a81bae96ec073ccdfc655999..26ebc322afa36994b4f1b93f992ac8b726263191 100644
1414
--- a/src/node_builtins.cc
1515
+++ b/src/node_builtins.cc
16-
@@ -435,6 +435,22 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(
17-
return maybe;
16+
@@ -482,6 +482,22 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
17+
return fn->Call(context, undefined, argc, argv);
1818
}
1919

2020
+MaybeLocal<Function> BuiltinLoader::LookupAndCompile(
@@ -34,21 +34,22 @@ index 4d4b59916bfdb203702c4e878ff2659b79de8c52..6451464c9fb411a1988bada86eabb407
3434
+}
3535
+
3636
bool BuiltinLoader::CompileAllBuiltins(Local<Context> context) {
37-
BuiltinLoader* loader = GetInstance();
38-
std::vector<std::string> ids = loader->GetBuiltinIds();
37+
std::vector<std::string_view> ids = GetBuiltinIds();
38+
bool all_succeeded = true;
3939
diff --git a/src/node_builtins.h b/src/node_builtins.h
40-
index 8d9f7c409659a30747e5feeac6cfec4208791370..34a51c3e5a79154c3633143b352aa9e108497767 100644
40+
index ba0c926a7968ec6a4cf07a469f1fd9314287a937..03ecd853b26a581f57b3311915fb7f46e713b00d 100644
4141
--- a/src/node_builtins.h
4242
+++ b/src/node_builtins.h
43-
@@ -50,6 +50,11 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
44-
v8::Local<v8::Context> context,
45-
const char* id,
46-
Environment* optional_env);
43+
@@ -107,6 +107,12 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
44+
const char* id,
45+
Realm* realm);
46+
4747
+ static v8::MaybeLocal<v8::Function> LookupAndCompile(
4848
+ v8::Local<v8::Context> context,
4949
+ const char* id,
5050
+ std::vector<v8::Local<v8::String>>* parameters,
5151
+ Environment* optional_env);
52-
53-
static v8::Local<v8::Object> GetSourceObject(v8::Local<v8::Context> context);
52+
+
5453
// Returns config.gypi as a JSON string
54+
v8::Local<v8::String> GetConfigString(v8::Isolate* isolate);
55+
bool Exists(const char* id);

0 commit comments

Comments
 (0)