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

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

Issue 1128823008: Use nonblocking IO mode as default for WebRTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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