From 1ca1c396ecd47ce5707e016409074c84cdaf4223 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Tue, 23 Jan 2018 03:28:56 -0500 Subject: [PATCH] Fix coding style of callback null tests --- net/tools/naive/naive_client_connection.cc | 6 +++--- net/tools/naive/socks5_server_socket.cc | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/net/tools/naive/naive_client_connection.cc b/net/tools/naive/naive_client_connection.cc index afed66d21b..53d0a57fde 100644 --- a/net/tools/naive/naive_client_connection.cc +++ b/net/tools/naive/naive_client_connection.cc @@ -56,7 +56,7 @@ NaiveClientConnection::~NaiveClientConnection() { int NaiveClientConnection::Connect(const CompletionCallback& callback) { DCHECK(client_socket_); DCHECK_EQ(next_state_, STATE_NONE); - DCHECK(connect_callback_.is_null()); + DCHECK(!connect_callback_); if (full_duplex_) return OK; @@ -84,7 +84,7 @@ void NaiveClientConnection::Disconnect() { void NaiveClientConnection::DoCallback(int result) { DCHECK_NE(result, ERR_IO_PENDING); - DCHECK(!connect_callback_.is_null()); + DCHECK(connect_callback_); // Since Run() may result in Read being called, // clear connect_callback_ up front. @@ -181,7 +181,7 @@ int NaiveClientConnection::Run(const CompletionCallback& callback) { DCHECK(client_socket_); DCHECK(server_socket_handle_->socket()); DCHECK_EQ(next_state_, STATE_NONE); - DCHECK(connect_callback_.is_null()); + DCHECK(!connect_callback_); run_callback_ = callback; diff --git a/net/tools/naive/socks5_server_socket.cc b/net/tools/naive/socks5_server_socket.cc index 191e3e304a..55fe79bf80 100644 --- a/net/tools/naive/socks5_server_socket.cc +++ b/net/tools/naive/socks5_server_socket.cc @@ -53,7 +53,7 @@ Socks5ServerSocket::~Socks5ServerSocket() { int Socks5ServerSocket::Connect(const CompletionCallback& callback) { DCHECK(transport_); DCHECK_EQ(STATE_NONE, next_state_); - DCHECK(user_callback_.is_null()); + DCHECK(!user_callback_); // If already connected, then just return OK. if (completed_handshake_) @@ -173,8 +173,8 @@ int Socks5ServerSocket::Read(IOBuffer* buf, const CompletionCallback& callback) { DCHECK(completed_handshake_); DCHECK_EQ(STATE_NONE, next_state_); - DCHECK(user_callback_.is_null()); - DCHECK(!callback.is_null()); + DCHECK(!user_callback_); + DCHECK(callback); int rv = transport_->Read(buf, buf_len, base::Bind(&Socks5ServerSocket::OnReadWriteComplete, @@ -191,8 +191,8 @@ int Socks5ServerSocket::Write(IOBuffer* buf, const CompletionCallback& callback) { DCHECK(completed_handshake_); DCHECK_EQ(STATE_NONE, next_state_); - DCHECK(user_callback_.is_null()); - DCHECK(!callback.is_null()); + DCHECK(!user_callback_); + DCHECK(callback); int rv = transport_->Write(buf, buf_len, @@ -213,7 +213,7 @@ int Socks5ServerSocket::SetSendBufferSize(int32_t size) { void Socks5ServerSocket::DoCallback(int result) { DCHECK_NE(ERR_IO_PENDING, result); - DCHECK(!user_callback_.is_null()); + DCHECK(user_callback_); // Since Run() may result in Read being called, // clear user_callback_ up front. @@ -232,7 +232,7 @@ void Socks5ServerSocket::OnIOComplete(int result) { void Socks5ServerSocket::OnReadWriteComplete(const CompletionCallback& callback, int result) { DCHECK_NE(ERR_IO_PENDING, result); - DCHECK(!callback.is_null()); + DCHECK(callback); if (result > 0) was_ever_used_ = true;