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/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 int socket_id, | 91 int socket_id, |
92 P2PMessageThrottler* throttler) | 92 P2PMessageThrottler* throttler) |
93 : P2PSocketHost(message_sender, socket_id, P2PSocketHost::UDP), | 93 : P2PSocketHost(message_sender, socket_id, P2PSocketHost::UDP), |
94 send_pending_(false), | 94 send_pending_(false), |
95 last_dscp_(net::DSCP_CS0), | 95 last_dscp_(net::DSCP_CS0), |
96 throttler_(throttler), | 96 throttler_(throttler), |
97 send_buffer_size_(0) { | 97 send_buffer_size_(0) { |
98 net::UDPServerSocket* socket = new net::UDPServerSocket( | 98 net::UDPServerSocket* socket = new net::UDPServerSocket( |
99 GetContentClient()->browser()->GetNetLog(), net::NetLog::Source()); | 99 GetContentClient()->browser()->GetNetLog(), net::NetLog::Source()); |
100 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
101 // If configured for finch experiment, use nonblocking IO. | 101 socket->UseNonBlockingIO(); |
102 if (base::FieldTrialList::FindFullName("WebRTC-UDPSocketNonBlockingIO") == | |
103 "Enabled") { | |
104 socket->UseNonBlockingIO(); | |
105 } | |
106 #endif | 102 #endif |
107 socket_.reset(socket); | 103 socket_.reset(socket); |
108 } | 104 } |
109 | 105 |
110 P2PSocketHostUdp::~P2PSocketHostUdp() { | 106 P2PSocketHostUdp::~P2PSocketHostUdp() { |
111 if (state_ == STATE_OPEN) { | 107 if (state_ == STATE_OPEN) { |
112 DCHECK(socket_.get()); | 108 DCHECK(socket_.get()); |
113 socket_.reset(); | 109 socket_.reset(); |
114 } | 110 } |
115 } | 111 } |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 case P2P_SOCKET_OPT_DSCP: | 394 case P2P_SOCKET_OPT_DSCP: |
399 return (net::OK == socket_->SetDiffServCodePoint( | 395 return (net::OK == socket_->SetDiffServCodePoint( |
400 static_cast<net::DiffServCodePoint>(value))) ? true : false; | 396 static_cast<net::DiffServCodePoint>(value))) ? true : false; |
401 default: | 397 default: |
402 NOTREACHED(); | 398 NOTREACHED(); |
403 return false; | 399 return false; |
404 } | 400 } |
405 } | 401 } |
406 | 402 |
407 } // namespace content | 403 } // namespace content |
OLD | NEW |