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/browser/renderer_host/p2p/socket_host_udp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" | 16 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" |
17 #include "content/common/p2p_messages.h" | 17 #include "content/common/p2p_messages.h" |
18 #include "content/public/browser/content_browser_client.h" | 18 #include "content/public/browser/content_browser_client.h" |
19 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
20 #include "ipc/ipc_sender.h" | 20 #include "ipc/ipc_sender.h" |
21 #include "net/base/io_buffer.h" | 21 #include "net/base/io_buffer.h" |
22 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 23 #include "net/log/net_log_source.h" |
23 #include "third_party/webrtc/media/base/rtputils.h" | 24 #include "third_party/webrtc/media/base/rtputils.h" |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 // UDP packets cannot be bigger than 64k. | 28 // UDP packets cannot be bigger than 64k. |
28 const int kReadBufferSize = 65536; | 29 const int kReadBufferSize = 65536; |
29 // Socket receive buffer size. | 30 // Socket receive buffer size. |
30 const int kRecvSocketBufferSize = 65536; // 64K | 31 const int kRecvSocketBufferSize = 65536; // 64K |
31 | 32 |
32 // Defines set of transient errors. These errors are ignored when we get them | 33 // Defines set of transient errors. These errors are ignored when we get them |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 default: | 439 default: |
439 NOTREACHED(); | 440 NOTREACHED(); |
440 return false; | 441 return false; |
441 } | 442 } |
442 } | 443 } |
443 | 444 |
444 // static | 445 // static |
445 std::unique_ptr<net::DatagramServerSocket> | 446 std::unique_ptr<net::DatagramServerSocket> |
446 P2PSocketHostUdp::DefaultSocketFactory() { | 447 P2PSocketHostUdp::DefaultSocketFactory() { |
447 net::UDPServerSocket* socket = new net::UDPServerSocket( | 448 net::UDPServerSocket* socket = new net::UDPServerSocket( |
448 GetContentClient()->browser()->GetNetLog(), net::NetLog::Source()); | 449 GetContentClient()->browser()->GetNetLog(), net::NetLogSource()); |
449 #if defined(OS_WIN) | 450 #if defined(OS_WIN) |
450 socket->UseNonBlockingIO(); | 451 socket->UseNonBlockingIO(); |
451 #endif | 452 #endif |
452 | 453 |
453 return base::WrapUnique(socket); | 454 return base::WrapUnique(socket); |
454 } | 455 } |
455 | 456 |
456 } // namespace content | 457 } // namespace content |
OLD | NEW |