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

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

Issue 2405273002: Remove MessageLoop::current() from socket_host_tcp.cc. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/sys_byteorder.h" 12 #include "base/sys_byteorder.h"
13 #include "base/threading/thread_task_runner_handle.h"
13 #include "content/common/p2p_messages.h" 14 #include "content/common/p2p_messages.h"
14 #include "ipc/ipc_sender.h" 15 #include "ipc/ipc_sender.h"
15 #include "jingle/glue/fake_ssl_client_socket.h" 16 #include "jingle/glue/fake_ssl_client_socket.h"
16 #include "jingle/glue/proxy_resolving_client_socket.h" 17 #include "jingle/glue/proxy_resolving_client_socket.h"
17 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
18 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
19 #include "net/socket/client_socket_factory.h" 20 #include "net/socket/client_socket_factory.h"
20 #include "net/socket/client_socket_handle.h" 21 #include "net/socket/client_socket_handle.h"
21 #include "net/socket/ssl_client_socket.h" 22 #include "net/socket/ssl_client_socket.h"
22 #include "net/socket/tcp_client_socket.h" 23 #include "net/socket/tcp_client_socket.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 url_context_, ssl_config, dest_host_port_pair)); 116 url_context_, ssl_config, dest_host_port_pair));
116 117
117 int status = socket_->Connect( 118 int status = socket_->Connect(
118 base::Bind(&P2PSocketHostTcpBase::OnConnected, 119 base::Bind(&P2PSocketHostTcpBase::OnConnected,
119 base::Unretained(this))); 120 base::Unretained(this)));
120 if (status != net::ERR_IO_PENDING) { 121 if (status != net::ERR_IO_PENDING) {
121 // We defer execution of ProcessConnectDone instead of calling it 122 // We defer execution of ProcessConnectDone instead of calling it
122 // directly here as the caller may not expect an error/close to 123 // directly here as the caller may not expect an error/close to
123 // happen here. This is okay, as from the caller's point of view, 124 // happen here. This is okay, as from the caller's point of view,
124 // the connect always happens asynchronously. 125 // the connect always happens asynchronously.
125 base::MessageLoop* message_loop = base::MessageLoop::current(); 126 base::ThreadTaskRunnerHandle::Get()->PostTask(
126 CHECK(message_loop);
127 message_loop->task_runner()->PostTask(
128 FROM_HERE, base::Bind(&P2PSocketHostTcpBase::OnConnected, 127 FROM_HERE, base::Bind(&P2PSocketHostTcpBase::OnConnected,
129 base::Unretained(this), status)); 128 base::Unretained(this), status));
130 } 129 }
131 130
132 return state_ != STATE_ERROR; 131 return state_ != STATE_ERROR;
133 } 132 }
134 133
135 void P2PSocketHostTcpBase::OnError() { 134 void P2PSocketHostTcpBase::OnError() {
136 socket_.reset(); 135 socket_.reset();
137 136
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } else { 642 } else {
644 packet_size += kTurnChannelDataHeaderSize; 643 packet_size += kTurnChannelDataHeaderSize;
645 // Calculate any padding if present. 644 // Calculate any padding if present.
646 if (packet_size % 4) 645 if (packet_size % 4)
647 *pad_bytes = 4 - packet_size % 4; 646 *pad_bytes = 4 - packet_size % 4;
648 } 647 }
649 return packet_size; 648 return packet_size;
650 } 649 }
651 650
652 } // namespace content 651 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698