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

Side by Side Diff: remoting/protocol/libjingle_transport_factory.cc

Issue 609923004: Cleanup usage of scoped_ptr<> in remoting for C++11 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 "remoting/protocol/libjingle_transport_factory.h" 5 #include "remoting/protocol/libjingle_transport_factory.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 void LibjingleTransport::NotifyConnected() { 188 void LibjingleTransport::NotifyConnected() {
189 // Create net::Socket adapter for the P2PTransportChannel. 189 // Create net::Socket adapter for the P2PTransportChannel.
190 scoped_ptr<jingle_glue::TransportChannelSocketAdapter> socket( 190 scoped_ptr<jingle_glue::TransportChannelSocketAdapter> socket(
191 new jingle_glue::TransportChannelSocketAdapter(channel_.get())); 191 new jingle_glue::TransportChannelSocketAdapter(channel_.get()));
192 socket->SetOnDestroyedCallback(base::Bind( 192 socket->SetOnDestroyedCallback(base::Bind(
193 &LibjingleTransport::OnChannelDestroyed, base::Unretained(this))); 193 &LibjingleTransport::OnChannelDestroyed, base::Unretained(this)));
194 194
195 Transport::ConnectedCallback callback = callback_; 195 Transport::ConnectedCallback callback = callback_;
196 callback_.Reset(); 196 callback_.Reset();
197 callback.Run(socket.PassAs<net::Socket>()); 197 callback.Run(socket.Pass());
198 } 198 }
199 199
200 void LibjingleTransport::AddRemoteCandidate( 200 void LibjingleTransport::AddRemoteCandidate(
201 const cricket::Candidate& candidate) { 201 const cricket::Candidate& candidate) {
202 DCHECK(CalledOnValidThread()); 202 DCHECK(CalledOnValidThread());
203 203
204 // To enforce the no-relay setting, it's not enough to not produce relay 204 // To enforce the no-relay setting, it's not enough to not produce relay
205 // candidates. It's also necessary to discard remote relay candidates. 205 // candidates. It's also necessary to discard remote relay candidates.
206 bool relay_allowed = (network_settings_.flags & 206 bool relay_allowed = (network_settings_.flags &
207 NetworkSettings::NAT_TRAVERSAL_RELAY) != 0; 207 NetworkSettings::NAT_TRAVERSAL_RELAY) != 0;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // If there is a pending |jingle_info_request_| delay starting the new 346 // If there is a pending |jingle_info_request_| delay starting the new
347 // transport until the request is finished. 347 // transport until the request is finished.
348 if (jingle_info_request_) { 348 if (jingle_info_request_) {
349 on_jingle_info_callbacks_.push_back( 349 on_jingle_info_callbacks_.push_back(
350 base::Bind(&LibjingleTransport::OnCanStart, 350 base::Bind(&LibjingleTransport::OnCanStart,
351 result->AsWeakPtr())); 351 result->AsWeakPtr()));
352 } else { 352 } else {
353 result->OnCanStart(); 353 result->OnCanStart();
354 } 354 }
355 355
356 return result.PassAs<Transport>(); 356 return result.Pass();
357 } 357 }
358 358
359 void LibjingleTransportFactory::EnsureFreshJingleInfo() { 359 void LibjingleTransportFactory::EnsureFreshJingleInfo() {
360 uint32 stun_or_relay_flags = NetworkSettings::NAT_TRAVERSAL_STUN | 360 uint32 stun_or_relay_flags = NetworkSettings::NAT_TRAVERSAL_STUN |
361 NetworkSettings::NAT_TRAVERSAL_RELAY; 361 NetworkSettings::NAT_TRAVERSAL_RELAY;
362 if (!(network_settings_.flags & stun_or_relay_flags) || 362 if (!(network_settings_.flags & stun_or_relay_flags) ||
363 jingle_info_request_) { 363 jingle_info_request_) {
364 return; 364 return;
365 } 365 }
366 366
(...skipping 22 matching lines...) Expand all
389 last_jingle_info_update_time_ = base::TimeTicks::Now(); 389 last_jingle_info_update_time_ = base::TimeTicks::Now();
390 390
391 while (!on_jingle_info_callbacks_.empty()) { 391 while (!on_jingle_info_callbacks_.empty()) {
392 on_jingle_info_callbacks_.begin()->Run(); 392 on_jingle_info_callbacks_.begin()->Run();
393 on_jingle_info_callbacks_.pop_front(); 393 on_jingle_info_callbacks_.pop_front();
394 } 394 }
395 } 395 }
396 396
397 } // namespace protocol 397 } // namespace protocol
398 } // namespace remoting 398 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698