From dbf036fcb743cfdcd5be421364c8b89b10ee3f55 Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Tue, 6 Dec 2011 23:33:24 +0000 Subject: base::Bind: Convert StreamSocket::Connect. BUG=none TEST=none R=csilv Review URL: http://codereview.chromium.org/8801004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113283 0039d316-1c4b-4281-b951-d872f2087c98 --- net/socket/tcp_client_socket_libevent.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'net/socket/tcp_client_socket_libevent.h') diff --git a/net/socket/tcp_client_socket_libevent.h b/net/socket/tcp_client_socket_libevent.h index 2a6b041..ac73f2c 100644 --- a/net/socket/tcp_client_socket_libevent.h +++ b/net/socket/tcp_client_socket_libevent.h @@ -42,8 +42,9 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, // Binds the socket to a local IP address and port. int Bind(const IPEndPoint& address); - // StreamSocket methods: + // StreamSocket implementation. virtual int Connect(OldCompletionCallback* callback) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) OVERRIDE; virtual void Disconnect() OVERRIDE; virtual bool IsConnected() const OVERRIDE; virtual bool IsConnectedAndIdle() const OVERRIDE; @@ -57,7 +58,7 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, virtual int64 NumBytesRead() const OVERRIDE; virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; - // Socket methods: + // Socket implementation. // Multiple outstanding requests are not supported. // Full duplex mode (reading and writing at the same time) is supported virtual int Read(IOBuffer* buf, @@ -100,14 +101,13 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, public: explicit WriteWatcher(TCPClientSocketLibevent* socket) : socket_(socket) {} - // MessageLoopForIO::Watcher methods - + // MessageLoopForIO::Watcher implementation. virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE {} - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE { if (socket_->waiting_connect()) { socket_->DidCompleteConnect(); - } else if (socket_->write_callback_) { + } else if (socket_->old_write_callback_ || + !socket_->write_callback_.is_null()) { socket_->DidCompleteWrite(); } } @@ -179,7 +179,8 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, OldCompletionCallback* read_callback_; // External callback; called when write is complete. - OldCompletionCallback* write_callback_; + OldCompletionCallback* old_write_callback_; + CompletionCallback write_callback_; // The next state for the Connect() state machine. ConnectState next_connect_state_; -- cgit v1.1