refactor: return-braced-init-list pt 2 of 2 (#44870)

* refactor: more return-braced-init-list, this time for v8 and gin objects

* refactor: more return-braced-init-list, this time for v8, gin, std, and base objects
This commit is contained in:
Charles Kerr 2024-11-29 11:44:33 -06:00 committed by GitHub
parent 4a695d07c6
commit f7e823ac80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 64 additions and 64 deletions

View file

@ -152,7 +152,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
"Electron contextBridge recursion depth exceeded. "
"Nested objects "
"deeper than 1000 are not supported.")));
return v8::MaybeLocal<v8::Value>();
return {};
}
// Certain primitives always use the current contexts prototype and we can
@ -209,7 +209,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
if (!v8::Function::New(destination_context, ProxyFunctionWrapper, state)
.ToLocal(&proxy_func))
return v8::MaybeLocal<v8::Value>();
return {};
SetPrivate(destination_context, proxy_func.As<v8::Object>(),
context_bridge::kOriginalFunctionPrivateKey, func);
object_cache->CacheProxiedObject(value, proxy_func);
@ -372,11 +372,11 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
arr->Get(source_context, i).ToLocalChecked(), value, object_cache,
support_dynamic_properties, recursion_depth + 1, error_target);
if (value_for_array.IsEmpty())
return v8::MaybeLocal<v8::Value>();
return {};
if (!IsTrue(cloned_arr->Set(destination_context, static_cast<int>(i),
value_for_array.ToLocalChecked()))) {
return v8::MaybeLocal<v8::Value>();
return {};
}
}
object_cache->CacheProxiedObject(value, cloned_arr);
@ -408,7 +408,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
object_value, source_context, destination_context, object_cache,
support_dynamic_properties, recursion_depth + 1, error_target);
if (passed_value.IsEmpty())
return v8::MaybeLocal<v8::Value>();
return {};
return v8::MaybeLocal<v8::Value>(passed_value.ToLocalChecked());
}
@ -421,7 +421,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
v8::Context::Scope error_scope(error_context);
// V8 serializer will throw an error if required
if (!gin::ConvertFromV8(error_context->GetIsolate(), value, &ret)) {
return v8::MaybeLocal<v8::Value>();
return {};
}
}
@ -651,7 +651,7 @@ v8::MaybeLocal<v8::Object> CreateProxyForAPI(
object_cache, support_dynamic_properties, recursion_depth + 1,
error_target);
if (passed_value.IsEmpty())
return v8::MaybeLocal<v8::Object>();
return {};
proxy.Set(key, passed_value.ToLocalChecked());
}

View file

@ -107,11 +107,11 @@ class IPCRenderer final : public gin::Wrappable<IPCRenderer>,
v8::Local<v8::Value> arguments) {
if (!electron_ipc_remote_) {
thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
return v8::Local<v8::Promise>();
return {};
}
blink::CloneableMessage message;
if (!electron::SerializeV8Value(isolate, arguments, &message)) {
return v8::Local<v8::Promise>();
return {};
}
gin_helper::Promise<blink::CloneableMessage> p(isolate);
auto handle = p.GetHandle();
@ -189,11 +189,11 @@ class IPCRenderer final : public gin::Wrappable<IPCRenderer>,
v8::Local<v8::Value> arguments) {
if (!electron_ipc_remote_) {
thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
return v8::Local<v8::Value>();
return {};
}
blink::CloneableMessage message;
if (!electron::SerializeV8Value(isolate, arguments, &message)) {
return v8::Local<v8::Value>();
return {};
}
blink::CloneableMessage result;