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.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 // UMA to track the histograms from 1ms to 1 sec for how long a packet spends | 394 // UMA to track the histograms from 1ms to 1 sec for how long a packet spends |
395 // in the browser process. | 395 // in the browser process. |
396 UMA_HISTOGRAM_TIMES("WebRTC.SystemSendPacketDuration_UDP" /* name */, | 396 UMA_HISTOGRAM_TIMES("WebRTC.SystemSendPacketDuration_UDP" /* name */, |
397 base::TimeTicks::Now() - send_time /* sample */); | 397 base::TimeTicks::Now() - send_time /* sample */); |
398 | 398 |
399 message_sender_->Send(new P2PMsg_OnSendComplete( | 399 message_sender_->Send(new P2PMsg_OnSendComplete( |
400 id_, | 400 id_, |
401 P2PSendPacketMetrics(packet_id, transport_sequence_number, send_time))); | 401 P2PSendPacketMetrics(packet_id, transport_sequence_number, send_time))); |
402 } | 402 } |
403 | 403 |
404 P2PSocketHost* P2PSocketHostUdp::AcceptIncomingTcpConnection( | 404 std::unique_ptr<P2PSocketHost> P2PSocketHostUdp::AcceptIncomingTcpConnection( |
405 const net::IPEndPoint& remote_address, int id) { | 405 const net::IPEndPoint& remote_address, |
| 406 int id) { |
406 NOTREACHED(); | 407 NOTREACHED(); |
407 OnError(); | 408 OnError(); |
408 return NULL; | 409 return nullptr; |
409 } | 410 } |
410 | 411 |
411 bool P2PSocketHostUdp::SetOption(P2PSocketOption option, int value) { | 412 bool P2PSocketHostUdp::SetOption(P2PSocketOption option, int value) { |
412 DCHECK_EQ(STATE_OPEN, state_); | 413 DCHECK_EQ(STATE_OPEN, state_); |
413 switch (option) { | 414 switch (option) { |
414 case P2P_SOCKET_OPT_RCVBUF: | 415 case P2P_SOCKET_OPT_RCVBUF: |
415 return socket_->SetReceiveBufferSize(value) == net::OK; | 416 return socket_->SetReceiveBufferSize(value) == net::OK; |
416 case P2P_SOCKET_OPT_SNDBUF: | 417 case P2P_SOCKET_OPT_SNDBUF: |
417 // Ignore any following call to set the send buffer size if we're under | 418 // Ignore any following call to set the send buffer size if we're under |
418 // experiment. | 419 // experiment. |
(...skipping 16 matching lines...) Expand all Loading... |
435 net::UDPServerSocket* socket = new net::UDPServerSocket( | 436 net::UDPServerSocket* socket = new net::UDPServerSocket( |
436 GetContentClient()->browser()->GetNetLog(), net::NetLog::Source()); | 437 GetContentClient()->browser()->GetNetLog(), net::NetLog::Source()); |
437 #if defined(OS_WIN) | 438 #if defined(OS_WIN) |
438 socket->UseNonBlockingIO(); | 439 socket->UseNonBlockingIO(); |
439 #endif | 440 #endif |
440 | 441 |
441 return base::WrapUnique(socket); | 442 return base::WrapUnique(socket); |
442 } | 443 } |
443 | 444 |
444 } // namespace content | 445 } // namespace content |
OLD | NEW |