Skip to content

Commit 4aa4a1e

Browse files
committed
src: update std::vector<v8::Local<T>> to use v8::LocalVector<T>
nodejs/node#57578
1 parent 603d0cd commit 4aa4a1e

6 files changed

Lines changed: 18 additions & 19 deletions

File tree

shell/common/node_bindings.cc

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

10031003
// Execute lib/node/init.ts.
1004-
std::vector<v8::Local<v8::String>> bundle_params = {
1005-
node::FIXED_ONE_BYTE_STRING(env->isolate(), "process"),
1006-
node::FIXED_ONE_BYTE_STRING(env->isolate(), "require"),
1007-
};
1008-
std::vector<v8::Local<v8::Value>> bundle_args = {process, require};
1004+
v8::LocalVector<v8::String> bundle_params(
1005+
env->isolate(), {node::FIXED_ONE_BYTE_STRING(env->isolate(), "process"),
1006+
node::FIXED_ONE_BYTE_STRING(env->isolate(), "require")});
1007+
v8::LocalVector<v8::Value> bundle_args(env->isolate(), {process, require});
10091008
electron::util::CompileAndCall(env->context(), "electron/js2c/node_init",
10101009
&bundle_params, &bundle_args);
10111010
}

shell/common/node_util.cc

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

shell/common/node_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ void EmitDeprecationWarning(std::string_view warning_msg,
5353
v8::MaybeLocal<v8::Value> CompileAndCall(
5454
v8::Local<v8::Context> context,
5555
const char* id,
56-
std::vector<v8::Local<v8::String>>* parameters,
57-
std::vector<v8::Local<v8::Value>>* arguments);
56+
v8::LocalVector<v8::String>* parameters,
57+
v8::LocalVector<v8::Value>* arguments);
5858

5959
// Wrapper for node::CreateEnvironment that logs failure
6060
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
@@ -124,10 +124,10 @@ void ElectronSandboxedRendererClient::DidCreateScriptContext(
124124
auto binding = v8::Object::New(isolate);
125125
InitializeBindings(binding, context, render_frame);
126126

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

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

132132
util::CompileAndCall(
133133
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)