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

@ -43,8 +43,8 @@ class TCPServerSocketFactory : public content::DevToolsSocketFactory {
private:
// content::ServerSocketFactory.
std::unique_ptr<net::ServerSocket> CreateForHttpServer() override {
std::unique_ptr<net::ServerSocket> socket(
new net::TCPServerSocket(nullptr, net::NetLogSource()));
auto socket =
std::make_unique<net::TCPServerSocket>(nullptr, net::NetLogSource());
if (socket->ListenWithAddressAndPort(address_, port_, 10) != net::OK)
return std::unique_ptr<net::ServerSocket>();
@ -77,8 +77,7 @@ std::unique_ptr<content::DevToolsSocketFactory> CreateSocketFactory() {
DLOG(WARNING) << "Invalid http debugger port number " << temp_port;
}
}
return std::unique_ptr<content::DevToolsSocketFactory>(
new TCPServerSocketFactory("127.0.0.1", port));
return std::make_unique<TCPServerSocketFactory>("127.0.0.1", port);
}
const char kBrowserCloseMethod[] = "Browser.close";