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

Side by Side Diff: content/renderer/p2p/port_allocator.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
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/renderer/p2p/port_allocator.h" 5 #include "content/renderer/p2p/port_allocator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 allocator, content_name, component, 101 allocator, content_name, component,
102 ice_username_fragment, ice_password), 102 ice_username_fragment, ice_password),
103 allocator_(allocator), 103 allocator_(allocator),
104 relay_session_attempts_(0), 104 relay_session_attempts_(0),
105 relay_udp_port_(0), 105 relay_udp_port_(0),
106 relay_tcp_port_(0), 106 relay_tcp_port_(0),
107 relay_ssltcp_port_(0) { 107 relay_ssltcp_port_(0) {
108 } 108 }
109 109
110 P2PPortAllocatorSession::~P2PPortAllocatorSession() { 110 P2PPortAllocatorSession::~P2PPortAllocatorSession() {
111 if (stun_address_request_) 111 if (stun_address_request_.get())
112 stun_address_request_->Cancel(); 112 stun_address_request_->Cancel();
113 } 113 }
114 114
115 void P2PPortAllocatorSession::didReceiveData( 115 void P2PPortAllocatorSession::didReceiveData(
116 WebURLLoader* loader, const char* data, 116 WebURLLoader* loader, const char* data,
117 int data_length, int encoded_data_length) { 117 int data_length, int encoded_data_length) {
118 DCHECK_EQ(loader, relay_session_request_.get()); 118 DCHECK_EQ(loader, relay_session_request_.get());
119 if (static_cast<int>(relay_session_response_.size()) + data_length > 119 if (static_cast<int>(relay_session_response_.size()) + data_length >
120 kMaximumRelayResponseSize) { 120 kMaximumRelayResponseSize) {
121 LOG(ERROR) << "Response received from the server is too big."; 121 LOG(ERROR) << "Response received from the server is too big.";
(...skipping 26 matching lines...) Expand all
148 } else { 148 } else {
149 AddConfig(); 149 AddConfig();
150 } 150 }
151 151
152 if (allocator_->config_.legacy_relay) { 152 if (allocator_->config_.legacy_relay) {
153 AllocateLegacyRelaySession(); 153 AllocateLegacyRelaySession();
154 } 154 }
155 } 155 }
156 156
157 void P2PPortAllocatorSession::ResolveStunServerAddress() { 157 void P2PPortAllocatorSession::ResolveStunServerAddress() {
158 if (stun_address_request_) 158 if (stun_address_request_.get())
159 return; 159 return;
160 160
161 stun_address_request_ = 161 stun_address_request_ =
162 new P2PHostAddressRequest(allocator_->socket_dispatcher_); 162 new P2PHostAddressRequest(allocator_->socket_dispatcher_);
163 stun_address_request_->Request(allocator_->config_.stun_server, base::Bind( 163 stun_address_request_->Request(allocator_->config_.stun_server, base::Bind(
164 &P2PPortAllocatorSession::OnStunServerAddress, 164 &P2PPortAllocatorSession::OnStunServerAddress,
165 base::Unretained(this))); 165 base::Unretained(this)));
166 } 166 }
167 167
168 void P2PPortAllocatorSession::OnStunServerAddress( 168 void P2PPortAllocatorSession::OnStunServerAddress(
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // Using the stun resolved address if available for TURN. 328 // Using the stun resolved address if available for TURN.
329 turn_config.ports.push_back(cricket::ProtocolAddress( 329 turn_config.ports.push_back(cricket::ProtocolAddress(
330 stun_server_address_, cricket::PROTO_UDP)); 330 stun_server_address_, cricket::PROTO_UDP));
331 config->AddRelay(turn_config); 331 config->AddRelay(turn_config);
332 } 332 }
333 } 333 }
334 ConfigReady(config); 334 ConfigReady(config);
335 } 335 }
336 336
337 } // namespace content 337 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_local_audio_track_unittest.cc ('k') | content/renderer/p2p/socket_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698