chore: remove unnecessary casting to base::Value (#37591)

Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
Milan Burda 2023-03-20 15:26:42 +01:00 committed by GitHub
parent 64b39dce14
commit 7ed3c7a359
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 8 deletions

View file

@ -153,7 +153,7 @@ v8::Local<v8::Promise> Debugger::SendCommand(gin::Arguments* args) {
request.Set("id", request_id);
request.Set("method", method);
if (!command_params.empty()) {
request.Set("params", base::Value(std::move(command_params)));
request.Set("params", std::move(command_params));
}
if (!session_id.empty()) {
@ -161,7 +161,7 @@ v8::Local<v8::Promise> Debugger::SendCommand(gin::Arguments* args) {
}
std::string json_args;
base::JSONWriter::Write(base::Value(std::move(request)), &json_args);
base::JSONWriter::Write(request, &json_args);
agent_host_->DispatchProtocolMessage(
this, base::as_bytes(base::make_span(json_args)));

View file

@ -159,8 +159,7 @@ v8::Local<v8::Value> HttpResponseHeadersToV8(
values->Append(base::Value(value));
}
}
return gin::ConvertToV8(v8::Isolate::GetCurrent(),
base::Value(std::move(response_headers)));
return gin::ConvertToV8(v8::Isolate::GetCurrent(), response_headers);
}
// Overloaded by multiple types to fill the |details| object.

View file

@ -623,7 +623,7 @@ void InspectableWebContents::AddDevToolsExtensionsToClient() {
extension_info.Set("exposeExperimentalAPIs",
extension->permissions_data()->HasAPIPermission(
extensions::mojom::APIPermissionID::kExperimental));
results.Append(base::Value(std::move(extension_info)));
results.Append(std::move(extension_info));
}
CallClientFunction("DevToolsAPI", "addExtensions",

View file

@ -282,7 +282,7 @@ void HandleAccessibilityRequestCallback(
descriptor.Set(kNative, is_native_enabled);
descriptor.Set(kWeb, is_web_enabled);
descriptor.Set(kLabelImages, are_accessibility_image_labels_enabled);
rvh_list.Append(base::Value(std::move(descriptor)));
rvh_list.Append(std::move(descriptor));
}
data.Set(kPagesField, std::move(rvh_list));
@ -295,7 +295,7 @@ void HandleAccessibilityRequestCallback(
data.Set(kBrowsersField, std::move(window_list));
std::string json_string;
base::JSONWriter::Write(base::Value(std::move(data)), &json_string);
base::JSONWriter::Write(data, &json_string);
std::move(callback).Run(
base::MakeRefCounted<base::RefCountedString>(std::move(json_string)));

View file

@ -166,7 +166,7 @@ v8::Local<v8::Value> Converter<net::HttpResponseHeaders*>::ToV8(
values->Append(value);
}
}
return ConvertToV8(isolate, base::Value(std::move(response_headers)));
return ConvertToV8(isolate, response_headers);
}
bool Converter<net::HttpResponseHeaders*>::FromV8(