Index: net/socket/tcp_client_socket_libevent.cc |
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc |
index d819ad7d7604d221099f90ebf2bb0c9965a6c846..1367dec9f13d227f9aeb973baa087d5aaa0248b5 100644 |
--- a/net/socket/tcp_client_socket_libevent.cc |
+++ b/net/socket/tcp_client_socket_libevent.cc |
@@ -144,6 +144,8 @@ TCPClientSocketLibevent::~TCPClientSocketLibevent() { |
} |
int TCPClientSocketLibevent::Connect(CompletionCallback* callback) { |
+ DCHECK(CalledOnValidThread()); |
+ |
// If already connected, then just return OK. |
if (socket_ != kInvalidSocket) |
return OK; |
@@ -218,6 +220,8 @@ int TCPClientSocketLibevent::DoConnect() { |
} |
void TCPClientSocketLibevent::Disconnect() { |
+ DCHECK(CalledOnValidThread()); |
+ |
if (socket_ == kInvalidSocket) |
return; |
@@ -236,6 +240,8 @@ void TCPClientSocketLibevent::Disconnect() { |
} |
bool TCPClientSocketLibevent::IsConnected() const { |
+ DCHECK(CalledOnValidThread()); |
+ |
if (socket_ == kInvalidSocket || waiting_connect_) |
return false; |
@@ -251,6 +257,8 @@ bool TCPClientSocketLibevent::IsConnected() const { |
} |
bool TCPClientSocketLibevent::IsConnectedAndIdle() const { |
+ DCHECK(CalledOnValidThread()); |
+ |
if (socket_ == kInvalidSocket || waiting_connect_) |
return false; |
@@ -269,6 +277,7 @@ bool TCPClientSocketLibevent::IsConnectedAndIdle() const { |
int TCPClientSocketLibevent::Read(IOBuffer* buf, |
int buf_len, |
CompletionCallback* callback) { |
+ DCHECK(CalledOnValidThread()); |
DCHECK_NE(kInvalidSocket, socket_); |
DCHECK(!waiting_connect_); |
DCHECK(!read_callback_); |
@@ -305,6 +314,7 @@ int TCPClientSocketLibevent::Read(IOBuffer* buf, |
int TCPClientSocketLibevent::Write(IOBuffer* buf, |
int buf_len, |
CompletionCallback* callback) { |
+ DCHECK(CalledOnValidThread()); |
DCHECK_NE(kInvalidSocket, socket_); |
DCHECK(!waiting_connect_); |
DCHECK(!write_callback_); |
@@ -338,6 +348,7 @@ int TCPClientSocketLibevent::Write(IOBuffer* buf, |
} |
bool TCPClientSocketLibevent::SetReceiveBufferSize(int32 size) { |
+ DCHECK(CalledOnValidThread()); |
int rv = setsockopt(socket_, SOL_SOCKET, SO_RCVBUF, |
reinterpret_cast<const char*>(&size), |
sizeof(size)); |
@@ -346,6 +357,7 @@ bool TCPClientSocketLibevent::SetReceiveBufferSize(int32 size) { |
} |
bool TCPClientSocketLibevent::SetSendBufferSize(int32 size) { |
+ DCHECK(CalledOnValidThread()); |
int rv = setsockopt(socket_, SOL_SOCKET, SO_SNDBUF, |
reinterpret_cast<const char*>(&size), |
sizeof(size)); |
@@ -477,6 +489,7 @@ void TCPClientSocketLibevent::DidCompleteWrite() { |
} |
int TCPClientSocketLibevent::GetPeerAddress(AddressList* address) const { |
+ DCHECK(CalledOnValidThread()); |
DCHECK(address); |
if (!current_ai_) |
return ERR_UNEXPECTED; |