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

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

Issue 1534193004: Use std::move() instead of scoped_ptr<>::Pass(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/webrtc_transport.h" 5 #include "remoting/protocol/webrtc_transport.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 return false; 226 return false;
227 } 227 }
228 228
229 if (peer_connection_->signaling_state() == 229 if (peer_connection_->signaling_state() ==
230 webrtc::PeerConnectionInterface::kStable) { 230 webrtc::PeerConnectionInterface::kStable) {
231 if (!peer_connection_->AddIceCandidate(candidate.get())) { 231 if (!peer_connection_->AddIceCandidate(candidate.get())) {
232 LOG(ERROR) << "Failed to add incoming ICE candidate."; 232 LOG(ERROR) << "Failed to add incoming ICE candidate.";
233 return false; 233 return false;
234 } 234 }
235 } else { 235 } else {
236 pending_incoming_candidates_.push_back(candidate.Pass()); 236 pending_incoming_candidates_.push_back(std::move(candidate));
237 } 237 }
238 } 238 }
239 239
240 return true; 240 return true;
241 } 241 }
242 242
243 StreamChannelFactory* WebrtcTransport::GetStreamChannelFactory() { 243 StreamChannelFactory* WebrtcTransport::GetStreamChannelFactory() {
244 DCHECK(thread_checker_.CalledOnValidThread()); 244 DCHECK(thread_checker_.CalledOnValidThread());
245 return &data_stream_adapter_; 245 return &data_stream_adapter_;
246 } 246 }
(...skipping 30 matching lines...) Expand all
277 277
278 // Format and send the session description to the peer. 278 // Format and send the session description to the peer.
279 scoped_ptr<XmlElement> transport_info( 279 scoped_ptr<XmlElement> transport_info(
280 new XmlElement(QName(kTransportNamespace, "transport"), true)); 280 new XmlElement(QName(kTransportNamespace, "transport"), true));
281 XmlElement* offer_tag = 281 XmlElement* offer_tag =
282 new XmlElement(QName(kTransportNamespace, "session-description")); 282 new XmlElement(QName(kTransportNamespace, "session-description"));
283 transport_info->AddElement(offer_tag); 283 transport_info->AddElement(offer_tag);
284 offer_tag->SetAttr(QName(std::string(), "type"), description->type()); 284 offer_tag->SetAttr(QName(std::string(), "type"), description->type());
285 offer_tag->SetBodyText(description_sdp); 285 offer_tag->SetBodyText(description_sdp);
286 286
287 event_handler_->OnOutgoingTransportInfo(transport_info.Pass()); 287 event_handler_->OnOutgoingTransportInfo(std::move(transport_info));
288 288
289 peer_connection_->SetLocalDescription( 289 peer_connection_->SetLocalDescription(
290 SetSessionDescriptionObserver::Create(base::Bind( 290 SetSessionDescriptionObserver::Create(base::Bind(
291 &WebrtcTransport::OnLocalDescriptionSet, weak_factory_.GetWeakPtr())), 291 &WebrtcTransport::OnLocalDescriptionSet, weak_factory_.GetWeakPtr())),
292 description.release()); 292 description.release());
293 } 293 }
294 294
295 void WebrtcTransport::OnLocalDescriptionSet(bool success, 295 void WebrtcTransport::OnLocalDescriptionSet(bool success,
296 const std::string& error) { 296 const std::string& error) {
297 DCHECK(thread_checker_.CalledOnValidThread()); 297 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 base::Bind(&WebrtcTransport::OnLocalSessionDescriptionCreated, 464 base::Bind(&WebrtcTransport::OnLocalSessionDescriptionCreated,
465 weak_factory_.GetWeakPtr())), 465 weak_factory_.GetWeakPtr())),
466 &offer_config); 466 &offer_config);
467 } 467 }
468 468
469 void WebrtcTransport::SendTransportInfo() { 469 void WebrtcTransport::SendTransportInfo() {
470 DCHECK(thread_checker_.CalledOnValidThread()); 470 DCHECK(thread_checker_.CalledOnValidThread());
471 DCHECK(pending_transport_info_message_); 471 DCHECK(pending_transport_info_message_);
472 472
473 event_handler_->OnOutgoingTransportInfo( 473 event_handler_->OnOutgoingTransportInfo(
474 pending_transport_info_message_.Pass()); 474 std::move(pending_transport_info_message_));
475 pending_transport_info_message_.reset(); 475 pending_transport_info_message_.reset();
476 } 476 }
477 477
478 void WebrtcTransport::AddPendingCandidatesIfPossible() { 478 void WebrtcTransport::AddPendingCandidatesIfPossible() {
479 DCHECK(thread_checker_.CalledOnValidThread()); 479 DCHECK(thread_checker_.CalledOnValidThread());
480 480
481 if (peer_connection_->signaling_state() == 481 if (peer_connection_->signaling_state() ==
482 webrtc::PeerConnectionInterface::kStable) { 482 webrtc::PeerConnectionInterface::kStable) {
483 for (auto candidate : pending_incoming_candidates_) { 483 for (auto candidate : pending_incoming_candidates_) {
484 if (!peer_connection_->AddIceCandidate(candidate)) { 484 if (!peer_connection_->AddIceCandidate(candidate)) {
(...skipping 14 matching lines...) Expand all
499 499
500 WebrtcTransportFactory::~WebrtcTransportFactory() {} 500 WebrtcTransportFactory::~WebrtcTransportFactory() {}
501 501
502 scoped_ptr<Transport> WebrtcTransportFactory::CreateTransport() { 502 scoped_ptr<Transport> WebrtcTransportFactory::CreateTransport() {
503 return make_scoped_ptr( 503 return make_scoped_ptr(
504 new WebrtcTransport(worker_thread_, transport_context_.get())); 504 new WebrtcTransport(worker_thread_, transport_context_.get()));
505 } 505 }
506 506
507 } // namespace protocol 507 } // namespace protocol
508 } // namespace remoting 508 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698