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

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: Move UDP socket experiment check to constructor. 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 data(new net::IOBuffer(content.size())), 61 data(new net::IOBuffer(content.size())),
62 size(content.size()), 62 size(content.size()),
63 packet_options(options), 63 packet_options(options),
64 id(id) { 64 id(id) {
65 memcpy(data->data(), &content[0], size); 65 memcpy(data->data(), &content[0], size);
66 } 66 }
67 67
68 P2PSocketHostUdp::PendingPacket::~PendingPacket() { 68 P2PSocketHostUdp::PendingPacket::~PendingPacket() {
69 } 69 }
70 70
71 P2PSocketHostUdp::P2PSocketHostUdp(IPC::Sender* message_sender, 71 P2PSocketHostUdp::P2PSocketHostUdp(IPC::Sender* message_sender, int socket_id,
Sergey Ulanov 2015/03/26 18:15:32 Formatting was correct here. One argument per line
John L. Miller 2015/03/26 18:23:10 Done.
72 int socket_id,
73 P2PMessageThrottler* throttler) 72 P2PMessageThrottler* throttler)
74 : P2PSocketHost(message_sender, socket_id, P2PSocketHost::UDP), 73 : P2PSocketHost(message_sender, socket_id, P2PSocketHost::UDP),
75 socket_(
76 new net::UDPServerSocket(GetContentClient()->browser()->GetNetLog(),
77 net::NetLog::Source())),
78 send_pending_(false), 74 send_pending_(false),
79 last_dscp_(net::DSCP_CS0), 75 last_dscp_(net::DSCP_CS0),
80 throttler_(throttler), 76 throttler_(throttler),
81 send_buffer_size_(0) { 77 send_buffer_size_(0) {
78 net::UDPServerSocket* socket = new net::UDPServerSocket(
79 GetContentClient()->browser()->GetNetLog(), net::NetLog::Source());
80 #if defined(OS_WIN)
81 // If configured for finch experiment, use nonblocking IO.
82 if (base::FieldTrialList::FindFullName("WebRTC-UDPSocketNonBlockingIO") ==
83 "Enabled") {
84 socket->UseNonBlockingIO();
85 }
86 #endif
87 socket_.reset(socket);
82 } 88 }
83 89
84 P2PSocketHostUdp::~P2PSocketHostUdp() { 90 P2PSocketHostUdp::~P2PSocketHostUdp() {
85 if (state_ == STATE_OPEN) { 91 if (state_ == STATE_OPEN) {
86 DCHECK(socket_.get()); 92 DCHECK(socket_.get());
87 socket_.reset(); 93 socket_.reset();
88 } 94 }
89 } 95 }
90 96
91 void P2PSocketHostUdp::SetSendBufferSize() { 97 void P2PSocketHostUdp::SetSendBufferSize() {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 case P2P_SOCKET_OPT_DSCP: 377 case P2P_SOCKET_OPT_DSCP:
372 return (net::OK == socket_->SetDiffServCodePoint( 378 return (net::OK == socket_->SetDiffServCodePoint(
373 static_cast<net::DiffServCodePoint>(value))) ? true : false; 379 static_cast<net::DiffServCodePoint>(value))) ? true : false;
374 default: 380 default:
375 NOTREACHED(); 381 NOTREACHED();
376 return false; 382 return false;
377 } 383 }
378 } 384 }
379 385
380 } // namespace content 386 } // 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