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.h" | 5 #include "content/browser/renderer_host/p2p/socket_host.h" |
6 | 6 |
| 7 #include "base/metrics/histogram.h" |
7 #include "base/sys_byteorder.h" | 8 #include "base/sys_byteorder.h" |
8 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" | 9 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
9 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" | 10 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" |
10 #include "content/browser/renderer_host/p2p/socket_host_udp.h" | 11 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
11 #include "content/browser/renderer_host/render_process_host_impl.h" | 12 #include "content/browser/renderer_host/render_process_host_impl.h" |
12 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
13 #include "crypto/hmac.h" | 14 #include "crypto/hmac.h" |
14 #include "third_party/libjingle/source/talk/p2p/base/stun.h" | 15 #include "third_party/libjingle/source/talk/p2p/base/stun.h" |
15 #include "third_party/webrtc/base/asyncpacketsocket.h" | 16 #include "third_party/webrtc/base/asyncpacketsocket.h" |
16 #include "third_party/webrtc/base/byteorder.h" | 17 #include "third_party/webrtc/base/byteorder.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 } | 454 } |
454 | 455 |
455 } // packet_processing_helpers | 456 } // packet_processing_helpers |
456 | 457 |
457 P2PSocketHost::P2PSocketHost(IPC::Sender* message_sender, int socket_id) | 458 P2PSocketHost::P2PSocketHost(IPC::Sender* message_sender, int socket_id) |
458 : message_sender_(message_sender), | 459 : message_sender_(message_sender), |
459 id_(socket_id), | 460 id_(socket_id), |
460 state_(STATE_UNINITIALIZED), | 461 state_(STATE_UNINITIALIZED), |
461 dump_incoming_rtp_packet_(false), | 462 dump_incoming_rtp_packet_(false), |
462 dump_outgoing_rtp_packet_(false), | 463 dump_outgoing_rtp_packet_(false), |
463 weak_ptr_factory_(this) { | 464 weak_ptr_factory_(this), |
| 465 send_queue_length_max_(0), |
| 466 protocol_type_(P2PSocketHost::UNKNOWN) { |
464 } | 467 } |
465 | 468 |
466 P2PSocketHost::~P2PSocketHost() { } | 469 P2PSocketHost::~P2PSocketHost() { |
| 470 DCHECK(protocol_type_ != P2PSocketHost::UNKNOWN); |
| 471 if (protocol_type_ == P2PSocketHost::UDP) { |
| 472 UMA_HISTOGRAM_COUNTS_100("WebRTC.MaxSystemConsecutiveEWB_UDP", |
| 473 send_queue_length_max_); |
| 474 } else { |
| 475 UMA_HISTOGRAM_COUNTS_100("WebRTC.MaxSystemConsecutiveEWB_TCP", |
| 476 send_queue_length_max_); |
| 477 } |
| 478 } |
467 | 479 |
468 // Verifies that the packet |data| has a valid STUN header. | 480 // Verifies that the packet |data| has a valid STUN header. |
469 // static | 481 // static |
470 bool P2PSocketHost::GetStunPacketType( | 482 bool P2PSocketHost::GetStunPacketType( |
471 const char* data, int data_size, StunMessageType* type) { | 483 const char* data, int data_size, StunMessageType* type) { |
472 | 484 |
473 if (data_size < kStunHeaderSize) { | 485 if (data_size < kStunHeaderSize) { |
474 return false; | 486 return false; |
475 } | 487 } |
476 | 488 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 BrowserThread::PostTask(BrowserThread::UI, | 650 BrowserThread::PostTask(BrowserThread::UI, |
639 FROM_HERE, | 651 FROM_HERE, |
640 base::Bind(packet_dump_callback_, | 652 base::Bind(packet_dump_callback_, |
641 Passed(&packet_header), | 653 Passed(&packet_header), |
642 header_length, | 654 header_length, |
643 packet_length, | 655 packet_length, |
644 incoming)); | 656 incoming)); |
645 } | 657 } |
646 | 658 |
647 } // namespace content | 659 } // namespace content |
OLD | NEW |