summaryrefslogtreecommitdiffstats
path: root/net/udp
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-09 18:43:55 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-09 18:43:55 +0000
commit83039bbf2f2ec0e918f7000b5212d104f60f2bb7 (patch)
treeb22dbd0051b57a437a588772a874271f0d02ffdb /net/udp
parente7456a206fe5b50aeb322ebabd6c26adc869a5fd (diff)
downloadchromium_src-83039bbf2f2ec0e918f7000b5212d104f60f2bb7.zip
chromium_src-83039bbf2f2ec0e918f7000b5212d104f60f2bb7.tar.gz
chromium_src-83039bbf2f2ec0e918f7000b5212d104f60f2bb7.tar.bz2
Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind().
This changes Socket::Read(), Socket::Write, and StreamSocket::Connect() to use CompletionCallback and fixes all users. BUG=none TEST=existing. Review URL: http://codereview.chromium.org/8824006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/udp')
-rw-r--r--net/udp/datagram_server_socket.h4
-rw-r--r--net/udp/udp_client_socket.cc7
-rw-r--r--net/udp/udp_client_socket.h4
-rw-r--r--net/udp/udp_server_socket.cc4
-rw-r--r--net/udp/udp_server_socket.h4
-rw-r--r--net/udp/udp_socket_libevent.cc76
-rw-r--r--net/udp/udp_socket_libevent.h18
-rw-r--r--net/udp/udp_socket_unittest.cc21
-rw-r--r--net/udp/udp_socket_win.cc64
-rw-r--r--net/udp/udp_socket_win.h14
10 files changed, 60 insertions, 156 deletions
diff --git a/net/udp/datagram_server_socket.h b/net/udp/datagram_server_socket.h
index cd20191..c83481c 100644
--- a/net/udp/datagram_server_socket.h
+++ b/net/udp/datagram_server_socket.h
@@ -39,7 +39,7 @@ class NET_EXPORT DatagramServerSocket : public DatagramSocket {
virtual int RecvFrom(IOBuffer* buf,
int buf_len,
IPEndPoint* address,
- OldCompletionCallback* callback) = 0;
+ const CompletionCallback& callback) = 0;
// Send to a socket with a particular destination.
// |buf| is the buffer to send
@@ -53,7 +53,7 @@ class NET_EXPORT DatagramServerSocket : public DatagramSocket {
virtual int SendTo(IOBuffer* buf,
int buf_len,
const IPEndPoint& address,
- OldCompletionCallback* callback) = 0;
+ const CompletionCallback& callback) = 0;
// Set the receive buffer size (in bytes) for the socket.
virtual bool SetReceiveBufferSize(int32 size) = 0;
diff --git a/net/udp/udp_client_socket.cc b/net/udp/udp_client_socket.cc
index 4bb3885..bbc32d4 100644
--- a/net/udp/udp_client_socket.cc
+++ b/net/udp/udp_client_socket.cc
@@ -24,18 +24,13 @@ int UDPClientSocket::Connect(const IPEndPoint& address) {
int UDPClientSocket::Read(IOBuffer* buf,
int buf_len,
- OldCompletionCallback* callback) {
- return socket_.Read(buf, buf_len, callback);
-}
-int UDPClientSocket::Read(IOBuffer* buf,
- int buf_len,
const CompletionCallback& callback) {
return socket_.Read(buf, buf_len, callback);
}
int UDPClientSocket::Write(IOBuffer* buf,
int buf_len,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return socket_.Write(buf, buf_len, callback);
}
diff --git a/net/udp/udp_client_socket.h b/net/udp/udp_client_socket.h
index b25df63..e28e6a4 100644
--- a/net/udp/udp_client_socket.h
+++ b/net/udp/udp_client_socket.h
@@ -27,11 +27,9 @@ class NET_EXPORT_PRIVATE UDPClientSocket : public DatagramClientSocket {
// DatagramClientSocket implementation.
virtual int Connect(const IPEndPoint& address) OVERRIDE;
virtual int Read(IOBuffer* buf, int buf_len,
- OldCompletionCallback* callback) OVERRIDE;
- virtual int Read(IOBuffer* buf, int buf_len,
const CompletionCallback& callback) OVERRIDE;
virtual int Write(IOBuffer* buf, int buf_len,
- OldCompletionCallback* callback) OVERRIDE;
+ const CompletionCallback& callback) OVERRIDE;
virtual void Close() OVERRIDE;
virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE;
virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
diff --git a/net/udp/udp_server_socket.cc b/net/udp/udp_server_socket.cc
index 7958463..b4395d2 100644
--- a/net/udp/udp_server_socket.cc
+++ b/net/udp/udp_server_socket.cc
@@ -26,14 +26,14 @@ int UDPServerSocket::Listen(const IPEndPoint& address) {
int UDPServerSocket::RecvFrom(IOBuffer* buf,
int buf_len,
IPEndPoint* address,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return socket_.RecvFrom(buf, buf_len, address, callback);
}
int UDPServerSocket::SendTo(IOBuffer* buf,
int buf_len,
const IPEndPoint& address,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return socket_.SendTo(buf, buf_len, address, callback);
}
diff --git a/net/udp/udp_server_socket.h b/net/udp/udp_server_socket.h
index bb6ac5c..89acb4f 100644
--- a/net/udp/udp_server_socket.h
+++ b/net/udp/udp_server_socket.h
@@ -27,11 +27,11 @@ class NET_EXPORT UDPServerSocket : public DatagramServerSocket {
virtual int RecvFrom(IOBuffer* buf,
int buf_len,
IPEndPoint* address,
- OldCompletionCallback* callback) OVERRIDE;
+ const CompletionCallback& callback) OVERRIDE;
virtual int SendTo(IOBuffer* buf,
int buf_len,
const IPEndPoint& address,
- OldCompletionCallback* callback) OVERRIDE;
+ const CompletionCallback& callback) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
virtual void Close() OVERRIDE;
diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc
index a669c37..f8ef7e3 100644
--- a/net/udp/udp_socket_libevent.cc
+++ b/net/udp/udp_socket_libevent.cc
@@ -47,8 +47,6 @@ UDPSocketLibevent::UDPSocketLibevent(
read_buf_len_(0),
recv_from_address_(NULL),
write_buf_len_(0),
- old_read_callback_(NULL),
- write_callback_(NULL),
net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_UDP_SOCKET)) {
scoped_refptr<NetLog::EventParameters> params;
if (source.is_valid())
@@ -72,12 +70,11 @@ void UDPSocketLibevent::Close() {
// Zero out any pending read/write callback state.
read_buf_ = NULL;
read_buf_len_ = 0;
- old_read_callback_ = NULL;
read_callback_.Reset();
recv_from_address_ = NULL;
write_buf_ = NULL;
write_buf_len_ = 0;
- write_callback_ = NULL;
+ write_callback_.Reset();
send_to_address_.reset();
bool ok = read_socket_watcher_.StopWatchingFileDescriptor();
@@ -137,11 +134,6 @@ int UDPSocketLibevent::GetLocalAddress(IPEndPoint* address) const {
int UDPSocketLibevent::Read(IOBuffer* buf,
int buf_len,
- OldCompletionCallback* callback) {
- return RecvFrom(buf, buf_len, NULL, callback);
-}
-int UDPSocketLibevent::Read(IOBuffer* buf,
- int buf_len,
const CompletionCallback& callback) {
return RecvFrom(buf, buf_len, NULL, callback);
}
@@ -149,40 +141,10 @@ int UDPSocketLibevent::Read(IOBuffer* buf,
int UDPSocketLibevent::RecvFrom(IOBuffer* buf,
int buf_len,
IPEndPoint* address,
- OldCompletionCallback* callback) {
- DCHECK(CalledOnValidThread());
- DCHECK_NE(kInvalidSocket, socket_);
- DCHECK(!old_read_callback_ && read_callback_.is_null());
- DCHECK(!recv_from_address_);
- DCHECK(callback); // Synchronous operation not supported
- DCHECK_GT(buf_len, 0);
-
- int nread = InternalRecvFrom(buf, buf_len, address);
- if (nread != ERR_IO_PENDING)
- return nread;
-
- if (!MessageLoopForIO::current()->WatchFileDescriptor(
- socket_, true, MessageLoopForIO::WATCH_READ,
- &read_socket_watcher_, &read_watcher_)) {
- PLOG(ERROR) << "WatchFileDescriptor failed on read";
- int result = MapSystemError(errno);
- LogRead(result, NULL, 0, NULL);
- return result;
- }
-
- read_buf_ = buf;
- read_buf_len_ = buf_len;
- recv_from_address_ = address;
- old_read_callback_ = callback;
- return ERR_IO_PENDING;
-}
-int UDPSocketLibevent::RecvFrom(IOBuffer* buf,
- int buf_len,
- IPEndPoint* address,
const CompletionCallback& callback) {
DCHECK(CalledOnValidThread());
DCHECK_NE(kInvalidSocket, socket_);
- DCHECK(!old_read_callback_ && read_callback_.is_null());
+ DCHECK(read_callback_.is_null());
DCHECK(!recv_from_address_);
DCHECK(!callback.is_null()); // Synchronous operation not supported
DCHECK_GT(buf_len, 0);
@@ -209,25 +171,25 @@ int UDPSocketLibevent::RecvFrom(IOBuffer* buf,
int UDPSocketLibevent::Write(IOBuffer* buf,
int buf_len,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return SendToOrWrite(buf, buf_len, NULL, callback);
}
int UDPSocketLibevent::SendTo(IOBuffer* buf,
int buf_len,
const IPEndPoint& address,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return SendToOrWrite(buf, buf_len, &address, callback);
}
int UDPSocketLibevent::SendToOrWrite(IOBuffer* buf,
int buf_len,
const IPEndPoint* address,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
DCHECK(CalledOnValidThread());
DCHECK_NE(kInvalidSocket, socket_);
- DCHECK(!write_callback_);
- DCHECK(callback); // Synchronous operation not supported
+ DCHECK(write_callback_.is_null());
+ DCHECK(!callback.is_null()); // Synchronous operation not supported
DCHECK_GT(buf_len, 0);
int result = InternalSendTo(buf, buf_len, address);
@@ -323,28 +285,22 @@ bool UDPSocketLibevent::SetSendBufferSize(int32 size) {
void UDPSocketLibevent::DoReadCallback(int rv) {
DCHECK_NE(rv, ERR_IO_PENDING);
- DCHECK(old_read_callback_ || !read_callback_.is_null());
+ DCHECK(!read_callback_.is_null());
- // Since Run may result in Read being called, clear read_callback_ up front.
- if (old_read_callback_) {
- OldCompletionCallback* c = old_read_callback_;
- old_read_callback_ = NULL;
- c->Run(rv);
- } else {
- CompletionCallback c = read_callback_;
- read_callback_.Reset();
- c.Run(rv);
- }
+ // since Run may result in Read being called, clear read_callback_ up front.
+ CompletionCallback c = read_callback_;
+ read_callback_.Reset();
+ c.Run(rv);
}
void UDPSocketLibevent::DoWriteCallback(int rv) {
DCHECK_NE(rv, ERR_IO_PENDING);
- DCHECK(write_callback_);
+ DCHECK(!write_callback_.is_null());
// since Run may result in Write being called, clear write_callback_ up front.
- OldCompletionCallback* c = write_callback_;
- write_callback_ = NULL;
- c->Run(rv);
+ CompletionCallback c = write_callback_;
+ write_callback_.Reset();
+ c.Run(rv);
}
void UDPSocketLibevent::DidCompleteRead() {
diff --git a/net/udp/udp_socket_libevent.h b/net/udp/udp_socket_libevent.h
index 6cef1c0..4317740 100644
--- a/net/udp/udp_socket_libevent.h
+++ b/net/udp/udp_socket_libevent.h
@@ -54,13 +54,12 @@ class UDPSocketLibevent : public base::NonThreadSafe {
// Read from the socket.
// Only usable from the client-side of a UDP socket, after the socket
// has been connected.
- int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback);
int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback);
// Write to the socket.
// Only usable from the client-side of a UDP socket, after the socket
// has been connected.
- int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback);
+ int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback);
// Read from a socket and receive sender address information.
// |buf| is the buffer to read data into.
@@ -78,10 +77,6 @@ class UDPSocketLibevent : public base::NonThreadSafe {
int RecvFrom(IOBuffer* buf,
int buf_len,
IPEndPoint* address,
- OldCompletionCallback* callback);
- int RecvFrom(IOBuffer* buf,
- int buf_len,
- IPEndPoint* address,
const CompletionCallback& callback);
// Send to a socket with a particular destination.
@@ -96,7 +91,7 @@ class UDPSocketLibevent : public base::NonThreadSafe {
int SendTo(IOBuffer* buf,
int buf_len,
const IPEndPoint& address,
- OldCompletionCallback* callback);
+ const CompletionCallback& callback);
// Set the receive buffer size (in bytes) for the socket.
bool SetReceiveBufferSize(int32 size);
@@ -119,7 +114,7 @@ class UDPSocketLibevent : public base::NonThreadSafe {
// MessageLoopForIO::Watcher methods
virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE {
- if (socket_->old_read_callback_ || !socket_->read_callback_.is_null())
+ if (!socket_->read_callback_.is_null())
socket_->DidCompleteRead();
}
@@ -140,7 +135,7 @@ class UDPSocketLibevent : public base::NonThreadSafe {
virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE {}
virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE {
- if (socket_->write_callback_)
+ if (!socket_->write_callback_.is_null())
socket_->DidCompleteWrite();
}
@@ -172,7 +167,7 @@ class UDPSocketLibevent : public base::NonThreadSafe {
int SendToOrWrite(IOBuffer* buf,
int buf_len,
const IPEndPoint* address,
- OldCompletionCallback* callback);
+ const CompletionCallback& callback);
int InternalConnect(const IPEndPoint& address);
int InternalRecvFrom(IOBuffer* buf, int buf_len, IPEndPoint* address);
@@ -214,11 +209,10 @@ class UDPSocketLibevent : public base::NonThreadSafe {
scoped_ptr<IPEndPoint> send_to_address_;
// External callback; called when read is complete.
- OldCompletionCallback* old_read_callback_;
CompletionCallback read_callback_;
// External callback; called when write is complete.
- OldCompletionCallback* write_callback_;
+ CompletionCallback write_callback_;
BoundNetLog net_log_;
diff --git a/net/udp/udp_socket_unittest.cc b/net/udp/udp_socket_unittest.cc
index 066b47c..5165d3d 100644
--- a/net/udp/udp_socket_unittest.cc
+++ b/net/udp/udp_socket_unittest.cc
@@ -32,10 +32,10 @@ class UDPSocketTest : public PlatformTest {
// Blocks until data is read from the socket.
std::string RecvFromSocket(UDPServerSocket* socket) {
- TestOldCompletionCallback callback;
+ TestCompletionCallback callback;
int rv = socket->RecvFrom(buffer_, kMaxRead, &recv_from_address_,
- &callback);
+ callback.callback());
if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
if (rv < 0)
@@ -55,7 +55,7 @@ class UDPSocketTest : public PlatformTest {
int SendToSocket(UDPServerSocket* socket,
std::string msg,
const IPEndPoint& address) {
- TestOldCompletionCallback callback;
+ TestCompletionCallback callback;
int length = msg.length();
scoped_refptr<StringIOBuffer> io_buffer(new StringIOBuffer(msg));
@@ -65,7 +65,7 @@ class UDPSocketTest : public PlatformTest {
int bytes_sent = 0;
while (buffer->BytesRemaining()) {
int rv = socket->SendTo(buffer, buffer->BytesRemaining(),
- address, &callback);
+ address, callback.callback());
if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
if (rv <= 0)
@@ -77,9 +77,9 @@ class UDPSocketTest : public PlatformTest {
}
std::string ReadSocket(UDPClientSocket* socket) {
- TestOldCompletionCallback callback;
+ TestCompletionCallback callback;
- int rv = socket->Read(buffer_, kMaxRead, &callback);
+ int rv = socket->Read(buffer_, kMaxRead, callback.callback());
if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
if (rv < 0)
@@ -90,7 +90,7 @@ class UDPSocketTest : public PlatformTest {
// Loop until |msg| has been written to the socket or until an
// error occurs.
int WriteSocket(UDPClientSocket* socket, std::string msg) {
- TestOldCompletionCallback callback;
+ TestCompletionCallback callback;
int length = msg.length();
scoped_refptr<StringIOBuffer> io_buffer(new StringIOBuffer(msg));
@@ -99,7 +99,8 @@ class UDPSocketTest : public PlatformTest {
int bytes_sent = 0;
while (buffer->BytesRemaining()) {
- int rv = socket->Write(buffer, buffer->BytesRemaining(), &callback);
+ int rv = socket->Write(buffer, buffer->BytesRemaining(),
+ callback.callback());
if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
if (rv <= 0)
@@ -433,9 +434,9 @@ TEST_F(UDPSocketTest, CloseWithPendingRead) {
int rv = server.Listen(bind_address);
EXPECT_EQ(OK, rv);
- TestOldCompletionCallback callback;
+ TestCompletionCallback callback;
IPEndPoint from;
- rv = server.RecvFrom(buffer_, kMaxRead, &from, &callback);
+ rv = server.RecvFrom(buffer_, kMaxRead, &from, callback.callback());
EXPECT_EQ(rv, ERR_IO_PENDING);
server.Close();
diff --git a/net/udp/udp_socket_win.cc b/net/udp/udp_socket_win.cc
index 88aa23b..06f5e3d 100644
--- a/net/udp/udp_socket_win.cc
+++ b/net/udp/udp_socket_win.cc
@@ -51,8 +51,6 @@ UDPSocketWin::UDPSocketWin(DatagramSocket::BindType bind_type,
ALLOW_THIS_IN_INITIALIZER_LIST(read_delegate_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(write_delegate_(this)),
recv_from_address_(NULL),
- old_read_callback_(NULL),
- write_callback_(NULL),
net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_UDP_SOCKET)) {
EnsureWinsockInit();
scoped_refptr<NetLog::EventParameters> params;
@@ -79,10 +77,9 @@ void UDPSocketWin::Close() {
return;
// Zero out any pending read/write callback state.
- old_read_callback_ = NULL;
read_callback_.Reset();
recv_from_address_ = NULL;
- write_callback_ = NULL;
+ write_callback_.Reset();
read_watcher_.StopWatching();
write_watcher_.StopWatching();
@@ -137,11 +134,6 @@ int UDPSocketWin::GetLocalAddress(IPEndPoint* address) const {
int UDPSocketWin::Read(IOBuffer* buf,
int buf_len,
- OldCompletionCallback* callback) {
- return RecvFrom(buf, buf_len, NULL, callback);
-}
-int UDPSocketWin::Read(IOBuffer* buf,
- int buf_len,
const CompletionCallback& callback) {
return RecvFrom(buf, buf_len, NULL, callback);
}
@@ -149,30 +141,10 @@ int UDPSocketWin::Read(IOBuffer* buf,
int UDPSocketWin::RecvFrom(IOBuffer* buf,
int buf_len,
IPEndPoint* address,
- OldCompletionCallback* callback) {
- DCHECK(CalledOnValidThread());
- DCHECK_NE(INVALID_SOCKET, socket_);
- DCHECK(!old_read_callback_ && read_callback_.is_null());
- DCHECK(!recv_from_address_);
- DCHECK(callback); // Synchronous operation not supported.
- DCHECK_GT(buf_len, 0);
-
- int nread = InternalRecvFrom(buf, buf_len, address);
- if (nread != ERR_IO_PENDING)
- return nread;
-
- read_iobuffer_ = buf;
- old_read_callback_ = callback;
- recv_from_address_ = address;
- return ERR_IO_PENDING;
-}
-int UDPSocketWin::RecvFrom(IOBuffer* buf,
- int buf_len,
- IPEndPoint* address,
const CompletionCallback& callback) {
DCHECK(CalledOnValidThread());
DCHECK_NE(INVALID_SOCKET, socket_);
- DCHECK(!old_read_callback_ && read_callback_.is_null());
+ DCHECK(read_callback_.is_null());
DCHECK(!recv_from_address_);
DCHECK(!callback.is_null()); // Synchronous operation not supported.
DCHECK_GT(buf_len, 0);
@@ -189,25 +161,25 @@ int UDPSocketWin::RecvFrom(IOBuffer* buf,
int UDPSocketWin::Write(IOBuffer* buf,
int buf_len,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return SendToOrWrite(buf, buf_len, NULL, callback);
}
int UDPSocketWin::SendTo(IOBuffer* buf,
int buf_len,
const IPEndPoint& address,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return SendToOrWrite(buf, buf_len, &address, callback);
}
int UDPSocketWin::SendToOrWrite(IOBuffer* buf,
int buf_len,
const IPEndPoint* address,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
DCHECK(CalledOnValidThread());
DCHECK_NE(INVALID_SOCKET, socket_);
- DCHECK(!write_callback_);
- DCHECK(callback); // Synchronous operation not supported.
+ DCHECK(write_callback_.is_null());
+ DCHECK(!callback.is_null()); // Synchronous operation not supported.
DCHECK_GT(buf_len, 0);
DCHECK(!send_to_address_.get());
@@ -298,28 +270,22 @@ bool UDPSocketWin::SetSendBufferSize(int32 size) {
void UDPSocketWin::DoReadCallback(int rv) {
DCHECK_NE(rv, ERR_IO_PENDING);
- DCHECK(old_read_callback_ || !read_callback_.is_null());
+ DCHECK(!read_callback_.is_null());
// since Run may result in Read being called, clear read_callback_ up front.
- if (old_read_callback_) {
- OldCompletionCallback* c = old_read_callback_;
- old_read_callback_ = NULL;
- c->Run(rv);
- } else {
- CompletionCallback c = read_callback_;
- read_callback_.Reset();
- c.Run(rv);
- }
+ CompletionCallback c = read_callback_;
+ read_callback_.Reset();
+ c.Run(rv);
}
void UDPSocketWin::DoWriteCallback(int rv) {
DCHECK_NE(rv, ERR_IO_PENDING);
- DCHECK(write_callback_);
+ DCHECK(!write_callback_.is_null());
// since Run may result in Write being called, clear write_callback_ up front.
- OldCompletionCallback* c = write_callback_;
- write_callback_ = NULL;
- c->Run(rv);
+ CompletionCallback c = write_callback_;
+ write_callback_.Reset();
+ c.Run(rv);
}
void UDPSocketWin::DidCompleteRead() {
diff --git a/net/udp/udp_socket_win.h b/net/udp/udp_socket_win.h
index 6aace29..d49f64d 100644
--- a/net/udp/udp_socket_win.h
+++ b/net/udp/udp_socket_win.h
@@ -55,13 +55,12 @@ class UDPSocketWin : public base::NonThreadSafe {
// Read from the socket.
// Only usable from the client-side of a UDP socket, after the socket
// has been connected.
- int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback);
int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback);
// Write to the socket.
// Only usable from the client-side of a UDP socket, after the socket
// has been connected.
- int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback);
+ int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback);
// Read from a socket and receive sender address information.
// |buf| is the buffer to read data into.
@@ -79,10 +78,6 @@ class UDPSocketWin : public base::NonThreadSafe {
int RecvFrom(IOBuffer* buf,
int buf_len,
IPEndPoint* address,
- OldCompletionCallback* callback);
- int RecvFrom(IOBuffer* buf,
- int buf_len,
- IPEndPoint* address,
const CompletionCallback& callback);
// Send to a socket with a particular destination.
@@ -97,7 +92,7 @@ class UDPSocketWin : public base::NonThreadSafe {
int SendTo(IOBuffer* buf,
int buf_len,
const IPEndPoint& address,
- OldCompletionCallback* callback);
+ const CompletionCallback& callback);
// Set the receive buffer size (in bytes) for the socket.
bool SetReceiveBufferSize(int32 size);
@@ -155,7 +150,7 @@ class UDPSocketWin : public base::NonThreadSafe {
int SendToOrWrite(IOBuffer* buf,
int buf_len,
const IPEndPoint* address,
- OldCompletionCallback* callback);
+ const CompletionCallback& callback);
int InternalConnect(const IPEndPoint& address);
int InternalRecvFrom(IOBuffer* buf, int buf_len, IPEndPoint* address);
@@ -208,11 +203,10 @@ class UDPSocketWin : public base::NonThreadSafe {
scoped_refptr<IOBuffer> write_iobuffer_;
// External callback; called when read is complete.
- OldCompletionCallback* old_read_callback_;
CompletionCallback read_callback_;
// External callback; called when write is complete.
- OldCompletionCallback* write_callback_;
+ CompletionCallback write_callback_;
BoundNetLog net_log_;