Fix coding style of callback null tests

This commit is contained in:
klzgrad 2018-01-23 03:28:56 -05:00
parent eb08ec17f2
commit 1ca1c396ec
2 changed files with 10 additions and 10 deletions

View File

@ -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;

View File

@ -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;