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:
parent
4a695d07c6
commit
f7e823ac80
35 changed files with 64 additions and 64 deletions
|
@ -532,14 +532,14 @@ gin::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create(
|
|||
gin_helper::Dictionary opts;
|
||||
if (!args->GetNext(&opts)) {
|
||||
args->ThrowTypeError("Expected a dictionary");
|
||||
return gin::Handle<SimpleURLLoaderWrapper>();
|
||||
return {};
|
||||
}
|
||||
auto request = std::make_unique<network::ResourceRequest>();
|
||||
opts.Get("method", &request->method);
|
||||
opts.Get("url", &request->url);
|
||||
if (!request->url.is_valid()) {
|
||||
args->ThrowTypeError("Invalid URL");
|
||||
return gin::Handle<SimpleURLLoaderWrapper>();
|
||||
return {};
|
||||
}
|
||||
request->site_for_cookies = net::SiteForCookies::FromUrl(request->url);
|
||||
opts.Get("referrer", &request->referrer);
|
||||
|
@ -607,7 +607,7 @@ gin::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create(
|
|||
if (!net::HttpUtil::IsValidHeaderName(it.first) ||
|
||||
!net::HttpUtil::IsValidHeaderValue(it.second)) {
|
||||
args->ThrowTypeError("Invalid header name or value");
|
||||
return gin::Handle<SimpleURLLoaderWrapper>();
|
||||
return {};
|
||||
}
|
||||
request->headers.SetHeader(it.first, it.second);
|
||||
}
|
||||
|
|
|
@ -49,10 +49,10 @@ v8::Local<v8::Value> GetHiddenValue(v8::Isolate* isolate,
|
|||
v8::Local<v8::Value> value;
|
||||
v8::Maybe<bool> result = object->HasPrivate(context, privateKey);
|
||||
if (!(result.IsJust() && result.FromJust()))
|
||||
return v8::Local<v8::Value>();
|
||||
return {};
|
||||
if (object->GetPrivate(context, privateKey).ToLocal(&value))
|
||||
return value;
|
||||
return v8::Local<v8::Value>();
|
||||
return {};
|
||||
}
|
||||
|
||||
void SetHiddenValue(v8::Isolate* isolate,
|
||||
|
|
|
@ -49,7 +49,7 @@ base::span<const APIPermissionInfo::InitInfo> GetPermissionInfos() {
|
|||
return base::make_span(permissions_to_register);
|
||||
}
|
||||
base::span<const Alias> GetPermissionAliases() {
|
||||
return base::span<const Alias>();
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -64,7 +64,7 @@ v8::Local<v8::Value> CallMethod(v8::Isolate* isolate,
|
|||
return scope.Escape(CustomEmit(isolate, v8_object, method_name,
|
||||
std::forward<Args>(args)...));
|
||||
else
|
||||
return v8::Local<v8::Value>();
|
||||
return {};
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
|
|
|
@ -101,7 +101,7 @@ class TrackableObject : public TrackableObjectBase, public EventEmitter<T> {
|
|||
if (weak_map_)
|
||||
return weak_map_->Values(isolate);
|
||||
else
|
||||
return std::vector<v8::Local<v8::Object>>();
|
||||
return {};
|
||||
}
|
||||
|
||||
// Removes this instance from the weak map.
|
||||
|
|
|
@ -25,7 +25,7 @@ std::optional<bool> IsUnsignedOrAdHocSigned(SecCodeRef code) {
|
|||
}
|
||||
if (status != errSecSuccess) {
|
||||
OSSTATUS_LOG(ERROR, status) << "SecCodeCopyStaticCode";
|
||||
return std::optional<bool>();
|
||||
return {};
|
||||
}
|
||||
// Copy the signing info from the SecStaticCodeRef.
|
||||
base::apple::ScopedCFTypeRef<CFDictionaryRef> signing_info;
|
||||
|
@ -34,7 +34,7 @@ std::optional<bool> IsUnsignedOrAdHocSigned(SecCodeRef code) {
|
|||
signing_info.InitializeInto());
|
||||
if (status != errSecSuccess) {
|
||||
OSSTATUS_LOG(ERROR, status) << "SecCodeCopySigningInformation";
|
||||
return std::optional<bool>();
|
||||
return {};
|
||||
}
|
||||
// Look up the code signing flags. If the flags are absent treat this as
|
||||
// unsigned. This decision is consistent with the StaticCode source:
|
||||
|
@ -51,7 +51,7 @@ std::optional<bool> IsUnsignedOrAdHocSigned(SecCodeRef code) {
|
|||
long long flags;
|
||||
if (!CFNumberGetValue(signing_info_flags, kCFNumberLongLongType, &flags)) {
|
||||
LOG(ERROR) << "CFNumberGetValue";
|
||||
return std::optional<bool>();
|
||||
return {};
|
||||
}
|
||||
if (static_cast<uint32_t>(flags) & kSecCodeSignatureAdhoc) {
|
||||
return true;
|
||||
|
|
|
@ -190,7 +190,7 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamically(
|
|||
v8::Local<v8::FixedArray> v8_import_assertions) {
|
||||
if (node::Environment::GetCurrent(context) == nullptr) {
|
||||
if (electron::IsBrowserProcess() || electron::IsUtilityProcess())
|
||||
return v8::MaybeLocal<v8::Promise>();
|
||||
return {};
|
||||
return blink::V8Initializer::HostImportModuleDynamically(
|
||||
context, v8_host_defined_options, v8_referrer_resource_url,
|
||||
v8_specifier, v8_import_assertions);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue