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

Unified Diff: content/browser/renderer_host/p2p/socket_host_udp_unittest.cc

Issue 8824006: Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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
Index: content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
diff --git a/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc b/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
index a33bc83d2e4f56b39d56c554302acf4286d0e940..02cc3b29a41710d5c86cea7a5ba8175040ff0d73 100644
--- a/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
+++ b/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc
@@ -30,7 +30,7 @@ class FakeDatagramServerSocket : public net::DatagramServerSocket {
// P2PSocketHostUdp destroyes a socket on errors so sent packets
// need to be stored outside of this object.
explicit FakeDatagramServerSocket(std::deque<UDPPacket>* sent_packets)
- : sent_packets_(sent_packets), recv_callback_(NULL) {
+ : sent_packets_(sent_packets) {
}
virtual void Close() OVERRIDE {
@@ -53,8 +53,8 @@ class FakeDatagramServerSocket : public net::DatagramServerSocket {
virtual int RecvFrom(net::IOBuffer* buf, int buf_len,
net::IPEndPoint* address,
- net::OldCompletionCallback* callback) OVERRIDE {
- CHECK(!recv_callback_);
+ const net::CompletionCallback& callback) OVERRIDE {
+ CHECK(recv_callback_.is_null());
if (incoming_packets_.size() > 0) {
scoped_refptr<net::IOBuffer> buffer(buf);
int size = std::min(
@@ -74,7 +74,7 @@ class FakeDatagramServerSocket : public net::DatagramServerSocket {
virtual int SendTo(net::IOBuffer* buf, int buf_len,
const net::IPEndPoint& address,
- net::OldCompletionCallback* callback) OVERRIDE {
+ const net::CompletionCallback& callback) OVERRIDE {
scoped_refptr<net::IOBuffer> buffer(buf);
std::vector<char> data_vector(buffer->data(), buffer->data() + buf_len);
sent_packets_->push_back(UDPPacket(address, data_vector));
@@ -90,14 +90,14 @@ class FakeDatagramServerSocket : public net::DatagramServerSocket {
}
void ReceivePacket(const net::IPEndPoint& address, std::vector<char> data) {
- if (recv_callback_) {
+ if (!recv_callback_.is_null()) {
int size = std::min(recv_size_, static_cast<int>(data.size()));
memcpy(recv_buffer_->data(), &*data.begin(), size);
*recv_address_ = address;
- net::OldCompletionCallback* cb = recv_callback_;
- recv_callback_ = NULL;
+ net::CompletionCallback cb = recv_callback_;
+ recv_callback_.Reset();
recv_buffer_ = NULL;
- cb->Run(size);
+ cb.Run(size);
} else {
incoming_packets_.push_back(UDPPacket(address, data));
}
@@ -116,7 +116,7 @@ class FakeDatagramServerSocket : public net::DatagramServerSocket {
scoped_refptr<net::IOBuffer> recv_buffer_;
net::IPEndPoint* recv_address_;
int recv_size_;
- net::OldCompletionCallback* recv_callback_;
+ net::CompletionCallback recv_callback_;
};
} // namespace
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_udp.cc ('k') | content/browser/renderer_host/pepper_tcp_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698