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

Unified Diff: content/browser/renderer_host/p2p/socket_host_tcp.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_tcp.cc
diff --git a/content/browser/renderer_host/p2p/socket_host_tcp.cc b/content/browser/renderer_host/p2p/socket_host_tcp.cc
index f88ff4a05718a8b1af94bb3e13519def0babfdbb..db94edc7573d9a0a2d7e9463c36e3040271300e7 100644
--- a/content/browser/renderer_host/p2p/socket_host_tcp.cc
+++ b/content/browser/renderer_host/p2p/socket_host_tcp.cc
@@ -21,13 +21,7 @@ namespace content {
P2PSocketHostTcp::P2PSocketHostTcp(IPC::Message::Sender* message_sender,
int routing_id, int id)
: P2PSocketHost(message_sender, routing_id, id),
- connected_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- connect_callback_(this, &P2PSocketHostTcp::OnConnected)),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- read_callback_(this, &P2PSocketHostTcp::OnRead)),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- write_callback_(this, &P2PSocketHostTcp::OnWritten)) {
+ connected_(false) {
}
P2PSocketHostTcp::~P2PSocketHostTcp() {
@@ -68,7 +62,8 @@ bool P2PSocketHostTcp::Init(const net::IPEndPoint& local_address,
if (socket_->SetSendBufferSize(kMaxSendBufferSize))
LOG(WARNING) << "Failed to set send buffer size for TCP socket.";
- int result = socket_->Connect(&connect_callback_);
+ int result = socket_->Connect(
+ base::Bind(&P2PSocketHostTcp::OnConnected, base::Unretained(this)));
if (result != net::ERR_IO_PENDING) {
OnConnected(result);
}
@@ -125,7 +120,8 @@ void P2PSocketHostTcp::DoRead() {
read_buffer_->RemainingCapacity());
}
result = socket_->Read(read_buffer_, read_buffer_->RemainingCapacity(),
- &read_callback_);
+ base::Bind(&P2PSocketHostTcp::OnRead,
+ base::Unretained(this)));
DidCompleteRead(result);
} while (result > 0);
}
@@ -232,7 +228,8 @@ void P2PSocketHostTcp::Send(const net::IPEndPoint& to,
void P2PSocketHostTcp::DoWrite() {
while (true) {
int result = socket_->Write(write_buffer_, write_buffer_->BytesRemaining(),
- &write_callback_);
+ base::Bind(&P2PSocketHostTcp::OnWritten,
+ base::Unretained(this)));
if (result >= 0) {
write_buffer_->DidConsume(result);
if (write_buffer_->BytesRemaining() == 0) {
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp.h ('k') | content/browser/renderer_host/p2p/socket_host_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698