Skip to content

Commit dd416aa

Browse files
committed
src: update std::vector<v8::Local<T>> to use v8::LocalVector<T>
nodejs/node#57578
1 parent 23daf0c commit dd416aa

File tree

6 files changed

+18
-19
lines changed

6 files changed

+18
-19
lines changed

shell/common/node_bindings.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -992,11 +992,10 @@ void OnNodePreload(node::Environment* env,
992992
}
993993

994994
// Execute lib/node/init.ts.
995-
std::vector<v8::Local<v8::String>> bundle_params = {
996-
node::FIXED_ONE_BYTE_STRING(env->isolate(), "process"),
997-
node::FIXED_ONE_BYTE_STRING(env->isolate(), "require"),
998-
};
999-
std::vector<v8::Local<v8::Value>> bundle_args = {process, require};
995+
v8::LocalVector<v8::String> bundle_params(
996+
env->isolate(), {node::FIXED_ONE_BYTE_STRING(env->isolate(), "process"),
997+
node::FIXED_ONE_BYTE_STRING(env->isolate(), "require")});
998+
v8::LocalVector<v8::Value> bundle_args(env->isolate(), {process, require});
1000999
electron::util::CompileAndCall(env->context(), "electron/js2c/node_init",
10011000
&bundle_params, &bundle_args);
10021001
}

shell/common/node_util.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ namespace electron::util {
2222
v8::MaybeLocal<v8::Value> CompileAndCall(
2323
v8::Local<v8::Context> context,
2424
const char* id,
25-
std::vector<v8::Local<v8::String>>* parameters,
26-
std::vector<v8::Local<v8::Value>>* arguments) {
25+
v8::LocalVector<v8::String>* parameters,
26+
v8::LocalVector<v8::Value>* arguments) {
2727
v8::Isolate* isolate = context->GetIsolate();
2828
v8::TryCatch try_catch(isolate);
2929

shell/common/node_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ void EmitWarning(std::string_view warning_msg, std::string_view warning_type);
4141
v8::MaybeLocal<v8::Value> CompileAndCall(
4242
v8::Local<v8::Context> context,
4343
const char* id,
44-
std::vector<v8::Local<v8::String>>* parameters,
45-
std::vector<v8::Local<v8::Value>>* arguments);
44+
v8::LocalVector<v8::String>* parameters,
45+
v8::LocalVector<v8::Value>* arguments);
4646

4747
// Wrapper for node::CreateEnvironment that logs failure
4848
node::Environment* CreateEnvironment(v8::Isolate* isolate,

shell/renderer/electron_sandboxed_renderer_client.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ void ElectronSandboxedRendererClient::DidCreateScriptContext(
125125
auto binding = v8::Object::New(isolate);
126126
InitializeBindings(binding, context, render_frame);
127127

128-
std::vector<v8::Local<v8::String>> sandbox_preload_bundle_params = {
129-
node::FIXED_ONE_BYTE_STRING(isolate, "binding")};
128+
v8::LocalVector<v8::String> sandbox_preload_bundle_params(
129+
isolate, {node::FIXED_ONE_BYTE_STRING(isolate, "binding")});
130130

131-
std::vector<v8::Local<v8::Value>> sandbox_preload_bundle_args = {binding};
131+
v8::LocalVector<v8::Value> sandbox_preload_bundle_args(isolate, {binding});
132132

133133
util::CompileAndCall(
134134
isolate->GetCurrentContext(), "electron/js2c/sandbox_bundle",

shell/renderer/preload_realm_context.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ class PreloadRealmLifetimeController
176176
process.SetReadOnly("type", "service-worker");
177177
process.SetReadOnly("contextIsolated", true);
178178

179-
std::vector<v8::Local<v8::String>> preload_realm_bundle_params = {
180-
node::FIXED_ONE_BYTE_STRING(isolate, "binding")};
179+
v8::LocalVector<v8::String> preload_realm_bundle_params(
180+
isolate, {node::FIXED_ONE_BYTE_STRING(isolate, "binding")});
181181

182-
std::vector<v8::Local<v8::Value>> preload_realm_bundle_args = {binding};
182+
v8::LocalVector<v8::Value> preload_realm_bundle_args(isolate, {binding});
183183

184184
util::CompileAndCall(context, "electron/js2c/preload_realm_bundle",
185185
&preload_realm_bundle_params,

shell/renderer/renderer_client_base.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,11 @@ void RendererClientBase::SetupMainWorldOverrides(
597597
}
598598
}
599599

600-
std::vector<v8::Local<v8::String>> isolated_bundle_params = {
601-
node::FIXED_ONE_BYTE_STRING(isolate, "isolatedApi")};
600+
v8::LocalVector<v8::String> isolated_bundle_params(
601+
isolate, {node::FIXED_ONE_BYTE_STRING(isolate, "isolatedApi")});
602602

603-
std::vector<v8::Local<v8::Value>> isolated_bundle_args = {
604-
isolated_api.GetHandle()};
603+
v8::LocalVector<v8::Value> isolated_bundle_args(isolate,
604+
{isolated_api.GetHandle()});
605605

606606
util::CompileAndCall(context, "electron/js2c/isolated_bundle",
607607
&isolated_bundle_params, &isolated_bundle_args);

0 commit comments

Comments
 (0)