Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Unified Diff: net/socket/tcp_client_socket_libevent.cc

Issue 2108022: Make TCPClientSocket* inherit from NonThreadSafe. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/tcp_client_socket_libevent.h ('k') | net/socket/tcp_client_socket_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « net/socket/tcp_client_socket_libevent.h ('k') | net/socket/tcp_client_socket_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698