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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_tcp.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h"
6 6
7 #include "base/location.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/sys_byteorder.h" 7 #include "base/sys_byteorder.h"
10 #include "content/common/p2p_messages.h" 8 #include "content/common/p2p_messages.h"
11 #include "ipc/ipc_sender.h" 9 #include "ipc/ipc_sender.h"
12 #include "jingle/glue/fake_ssl_client_socket.h" 10 #include "jingle/glue/fake_ssl_client_socket.h"
13 #include "jingle/glue/proxy_resolving_client_socket.h" 11 #include "jingle/glue/proxy_resolving_client_socket.h"
14 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
15 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
16 #include "net/base/net_util.h" 14 #include "net/base/net_util.h"
17 #include "net/socket/client_socket_factory.h" 15 #include "net/socket/client_socket_factory.h"
18 #include "net/socket/client_socket_handle.h" 16 #include "net/socket/client_socket_handle.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 int status = socket_->Connect( 110 int status = socket_->Connect(
113 base::Bind(&P2PSocketHostTcpBase::OnConnected, 111 base::Bind(&P2PSocketHostTcpBase::OnConnected,
114 base::Unretained(this))); 112 base::Unretained(this)));
115 if (status != net::ERR_IO_PENDING) { 113 if (status != net::ERR_IO_PENDING) {
116 // We defer execution of ProcessConnectDone instead of calling it 114 // We defer execution of ProcessConnectDone instead of calling it
117 // directly here as the caller may not expect an error/close to 115 // directly here as the caller may not expect an error/close to
118 // happen here. This is okay, as from the caller's point of view, 116 // happen here. This is okay, as from the caller's point of view,
119 // the connect always happens asynchronously. 117 // the connect always happens asynchronously.
120 base::MessageLoop* message_loop = base::MessageLoop::current(); 118 base::MessageLoop* message_loop = base::MessageLoop::current();
121 CHECK(message_loop); 119 CHECK(message_loop);
122 message_loop->task_runner()->PostTask( 120 message_loop->PostTask(
123 FROM_HERE, base::Bind(&P2PSocketHostTcpBase::OnConnected, 121 FROM_HERE,
124 base::Unretained(this), status)); 122 base::Bind(&P2PSocketHostTcpBase::OnConnected,
123 base::Unretained(this), status));
125 } 124 }
126 125
127 return state_ != STATE_ERROR; 126 return state_ != STATE_ERROR;
128 } 127 }
129 128
130 void P2PSocketHostTcpBase::OnError() { 129 void P2PSocketHostTcpBase::OnError() {
131 socket_.reset(); 130 socket_.reset();
132 131
133 if (state_ == STATE_UNINITIALIZED || state_ == STATE_CONNECTING || 132 if (state_ == STATE_UNINITIALIZED || state_ == STATE_CONNECTING ||
134 state_ == STATE_TLS_CONNECTING || state_ == STATE_OPEN) { 133 state_ == STATE_TLS_CONNECTING || state_ == STATE_OPEN) {
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 } else { 626 } else {
628 packet_size += kTurnChannelDataHeaderSize; 627 packet_size += kTurnChannelDataHeaderSize;
629 // Calculate any padding if present. 628 // Calculate any padding if present.
630 if (packet_size % 4) 629 if (packet_size % 4)
631 *pad_bytes = 4 - packet_size % 4; 630 *pad_bytes = 4 - packet_size % 4;
632 } 631 }
633 return packet_size; 632 return packet_size;
634 } 633 }
635 634
636 } // namespace content 635 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698