OLD | NEW |
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/renderer/p2p/ipc_socket_factory.h" | 5 #include "content/renderer/p2p/ipc_socket_factory.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "content/renderer/p2p/socket_client.h" | 13 #include "content/renderer/p2p/socket_client.h" |
14 #include "content/renderer/p2p/socket_dispatcher.h" | 14 #include "content/renderer/p2p/socket_dispatcher.h" |
15 #include "jingle/glue/utils.h" | 15 #include "jingle/glue/utils.h" |
16 #include "third_party/libjingle/source/talk/base/asyncpacketsocket.h" | 16 #include "third_party/libjingle/source/talk/base/asyncpacketsocket.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 bool IsTcpClientSocket(P2PSocketType type) { | 22 bool IsTcpClientSocket(P2PSocketType type) { |
23 return (type == P2P_SOCKET_STUN_TCP_CLIENT) || | 23 return (type == P2P_SOCKET_STUN_TCP_CLIENT) || |
24 (type == P2P_SOCKET_TCP_CLIENT); | 24 (type == P2P_SOCKET_TCP_CLIENT) || |
| 25 (type == P2P_SOCKET_STUN_SSLTCP_CLIENT) || |
| 26 (type == P2P_SOCKET_SSLTCP_CLIENT); |
25 } | 27 } |
26 | 28 |
27 // TODO(miu): This needs tuning. http://crbug.com/237960 | 29 // TODO(miu): This needs tuning. http://crbug.com/237960 |
28 const size_t kMaximumInFlightBytes = 64 * 1024; // 64 KB | 30 const size_t kMaximumInFlightBytes = 64 * 1024; // 64 KB |
29 | 31 |
30 // IpcPacketSocket implements talk_base::AsyncPacketSocket interface | 32 // IpcPacketSocket implements talk_base::AsyncPacketSocket interface |
31 // using P2PSocketClient that works over IPC-channel. It must be used | 33 // using P2PSocketClient that works over IPC-channel. It must be used |
32 // on the thread it was created. | 34 // on the thread it was created. |
33 class IpcPacketSocket : public talk_base::AsyncPacketSocket, | 35 class IpcPacketSocket : public talk_base::AsyncPacketSocket, |
34 public P2PSocketClient::Delegate { | 36 public P2PSocketClient::Delegate { |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } | 439 } |
438 P2PSocketClient* socket_client = new P2PSocketClient(socket_dispatcher_); | 440 P2PSocketClient* socket_client = new P2PSocketClient(socket_dispatcher_); |
439 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); | 441 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); |
440 if (!socket->Init(type, socket_client, local_address, | 442 if (!socket->Init(type, socket_client, local_address, |
441 remote_address)) | 443 remote_address)) |
442 return NULL; | 444 return NULL; |
443 return socket.release(); | 445 return socket.release(); |
444 } | 446 } |
445 | 447 |
446 } // namespace content | 448 } // namespace content |
OLD | NEW |