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

Unified Diff: content/browser/renderer_host/p2p/socket_host_udp.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.cc
diff --git a/content/browser/renderer_host/p2p/socket_host_udp.cc b/content/browser/renderer_host/p2p/socket_host_udp.cc
index f85e80df268d3db7d974e7d7a8f2b253e11e1ea8..e5c4b0108325a9a17c63cd410759c26781715880 100644
--- a/content/browser/renderer_host/p2p/socket_host_udp.cc
+++ b/content/browser/renderer_host/p2p/socket_host_udp.cc
@@ -4,6 +4,7 @@
#include "content/browser/renderer_host/p2p/socket_host_udp.h"
+#include "base/bind.h"
#include "content/common/p2p_messages.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -34,11 +35,7 @@ P2PSocketHostUdp::P2PSocketHostUdp(IPC::Message::Sender* message_sender,
: P2PSocketHost(message_sender, routing_id, id),
socket_(new net::UDPServerSocket(NULL, net::NetLog::Source())),
send_queue_bytes_(0),
- send_pending_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- recv_callback_(this, &P2PSocketHostUdp::OnRecv)),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- send_callback_(this, &P2PSocketHostUdp::OnSend)) {
+ send_pending_(false) {
}
P2PSocketHostUdp::~P2PSocketHostUdp() {
@@ -93,7 +90,8 @@ void P2PSocketHostUdp::DoRead() {
int result;
do {
result = socket_->RecvFrom(recv_buffer_, kReadBufferSize, &recv_address_,
- &recv_callback_);
+ base::Bind(&P2PSocketHostUdp::OnRecv,
+ base::Unretained(this)));
DidCompleteRead(result);
} while (result > 0);
}
@@ -167,7 +165,8 @@ void P2PSocketHostUdp::Send(const net::IPEndPoint& to,
void P2PSocketHostUdp::DoSend(const PendingPacket& packet) {
int result = socket_->SendTo(packet.data, packet.size, packet.to,
- &send_callback_);
+ base::Bind(&P2PSocketHostUdp::OnSend,
+ base::Unretained(this)));
if (result == net::ERR_IO_PENDING) {
send_pending_ = true;
} else if (result < 0) {
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_udp.h ('k') | content/browser/renderer_host/p2p/socket_host_udp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698