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

Unified Diff: net/socket/tcp_server_socket_libevent.cc

Issue 8771030: base::Bind: Convert ServerSocket::Accept. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test logic fix. Created 9 years 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_server_socket_libevent.h ('k') | net/socket/tcp_server_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_server_socket_libevent.cc
diff --git a/net/socket/tcp_server_socket_libevent.cc b/net/socket/tcp_server_socket_libevent.cc
index 5ed52a91fc46bd81c223aeedfa21453846c0bb0b..e793dd65749d2726146d2d31685c7a4fe023b94c 100644
--- a/net/socket/tcp_server_socket_libevent.cc
+++ b/net/socket/tcp_server_socket_libevent.cc
@@ -34,7 +34,6 @@ TCPServerSocketLibevent::TCPServerSocketLibevent(
const net::NetLog::Source& source)
: socket_(kInvalidSocket),
accept_socket_(NULL),
- accept_callback_(NULL),
net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)) {
scoped_refptr<NetLog::EventParameters> params;
if (source.is_valid())
@@ -106,11 +105,11 @@ int TCPServerSocketLibevent::GetLocalAddress(IPEndPoint* address) const {
}
int TCPServerSocketLibevent::Accept(
- scoped_ptr<StreamSocket>* socket, OldCompletionCallback* callback) {
+ scoped_ptr<StreamSocket>* socket, const CompletionCallback& callback) {
DCHECK(CalledOnValidThread());
DCHECK(socket);
- DCHECK(callback);
- DCHECK(!accept_callback_);
+ DCHECK(!callback.is_null());
+ DCHECK(accept_callback_.is_null());
net_log_.BeginEvent(NetLog::TYPE_TCP_ACCEPT, NULL);
@@ -185,12 +184,11 @@ void TCPServerSocketLibevent::OnFileCanReadWithoutBlocking(int fd) {
int result = AcceptInternal(accept_socket_);
if (result != ERR_IO_PENDING) {
- OldCompletionCallback* c = accept_callback_;
- accept_callback_ = NULL;
accept_socket_ = NULL;
bool ok = accept_socket_watcher_.StopWatchingFileDescriptor();
DCHECK(ok);
- c->Run(result);
+ accept_callback_.Run(result);
+ accept_callback_.Reset();
}
}
« no previous file with comments | « net/socket/tcp_server_socket_libevent.h ('k') | net/socket/tcp_server_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698