Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_udp.cc

Issue 972203002: Support finch experiment WebRTC-UDPServerSocketAsync for Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } else { 102 } else {
103 send_buffer_size_ = send_buffer_size; 103 send_buffer_size_ = send_buffer_size;
104 } 104 }
105 } 105 }
106 } 106 }
107 107
108 bool P2PSocketHostUdp::Init(const net::IPEndPoint& local_address, 108 bool P2PSocketHostUdp::Init(const net::IPEndPoint& local_address,
109 const P2PHostAndIPEndPoint& remote_address) { 109 const P2PHostAndIPEndPoint& remote_address) {
110 DCHECK_EQ(state_, STATE_UNINITIALIZED); 110 DCHECK_EQ(state_, STATE_UNINITIALIZED);
111 111
112 #if defined(OS_WIN)
113 // If configured for finch experiment, use nonblocking IO.
114 unsigned int use_nonblocking_io = 0;
115
116 base::StringToUint(
117 base::FieldTrialList::FindFullName(
118 "WebRTC-UDPServerSocketAsync"),
119 &use_nonblocking_io);
120 if (use_nonblocking_io > 0) {
guoweis_left_chromium 2015/03/03 17:43:39 Instead of using 0 to stand for disabled, could we
John L. Miller 2015/03/23 14:11:27 Done.
121 _socket::UseNonBlockingIO();
122 }
123 #endif
124
112 int result = socket_->Listen(local_address); 125 int result = socket_->Listen(local_address);
113 if (result < 0) { 126 if (result < 0) {
114 LOG(ERROR) << "bind() failed: " << result; 127 LOG(ERROR) << "bind() failed: " << result;
115 OnError(); 128 OnError();
116 return false; 129 return false;
117 } 130 }
118 131
119 // Setting recv socket buffer size. 132 // Setting recv socket buffer size.
120 if (socket_->SetReceiveBufferSize(kRecvSocketBufferSize) != net::OK) { 133 if (socket_->SetReceiveBufferSize(kRecvSocketBufferSize) != net::OK) {
121 LOG(WARNING) << "Failed to set socket receive buffer size to " 134 LOG(WARNING) << "Failed to set socket receive buffer size to "
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 case P2P_SOCKET_OPT_DSCP: 384 case P2P_SOCKET_OPT_DSCP:
372 return (net::OK == socket_->SetDiffServCodePoint( 385 return (net::OK == socket_->SetDiffServCodePoint(
373 static_cast<net::DiffServCodePoint>(value))) ? true : false; 386 static_cast<net::DiffServCodePoint>(value))) ? true : false;
374 default: 387 default:
375 NOTREACHED(); 388 NOTREACHED();
376 return false; 389 return false;
377 } 390 }
378 } 391 }
379 392
380 } // namespace content 393 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698