chore: use std::make_unique/base::MakeRefCounted when possible (#29510)

This commit is contained in:
David Sanders 2021-06-07 19:00:05 -07:00 committed by GitHub
parent a4decffe9a
commit 79cb5144ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 106 additions and 101 deletions

View file

@ -97,15 +97,17 @@ network::mojom::URLResponseHeadPtr ToResponseHead(
head->mime_type = "text/html";
head->charset = "utf-8";
if (dict.IsEmpty()) {
head->headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
head->headers =
base::MakeRefCounted<net::HttpResponseHeaders>("HTTP/1.1 200 OK");
return head;
}
int status_code = net::HTTP_OK;
dict.Get("statusCode", &status_code);
head->headers = new net::HttpResponseHeaders(base::StringPrintf(
"HTTP/1.1 %d %s", status_code,
net::GetHttpReasonPhrase(static_cast<net::HttpStatusCode>(status_code))));
head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(
base::StringPrintf("HTTP/1.1 %d %s", status_code,
net::GetHttpReasonPhrase(
static_cast<net::HttpStatusCode>(status_code))));
dict.Get("charset", &head->charset);
bool has_mime_type = dict.Get("mimeType", &head->mime_type);