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

Side by Side Diff: remoting/protocol/ice_transport_channel.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/ice_transport_channel.h" 5 #include "remoting/protocol/ice_transport_channel.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 transport_context_->CreatePortAllocator( 85 transport_context_->CreatePortAllocator(
86 base::Bind(&IceTransportChannel::OnPortAllocatorCreated, 86 base::Bind(&IceTransportChannel::OnPortAllocatorCreated,
87 weak_factory_.GetWeakPtr())); 87 weak_factory_.GetWeakPtr()));
88 } 88 }
89 89
90 void IceTransportChannel::OnPortAllocatorCreated( 90 void IceTransportChannel::OnPortAllocatorCreated(
91 scoped_ptr<cricket::PortAllocator> port_allocator){ 91 scoped_ptr<cricket::PortAllocator> port_allocator){
92 DCHECK(!channel_.get()); 92 DCHECK(!channel_.get());
93 93
94 port_allocator_ = port_allocator.Pass(); 94 port_allocator_ = std::move(port_allocator);
95 95
96 // Create P2PTransportChannel, attach signal handlers and connect it. 96 // Create P2PTransportChannel, attach signal handlers and connect it.
97 // TODO(sergeyu): Specify correct component ID for the channel. 97 // TODO(sergeyu): Specify correct component ID for the channel.
98 channel_.reset(new cricket::P2PTransportChannel( 98 channel_.reset(new cricket::P2PTransportChannel(
99 std::string(), 0, nullptr, port_allocator_.get())); 99 std::string(), 0, nullptr, port_allocator_.get()));
100 std::string ice_password = rtc::CreateRandomString(cricket::ICE_PWD_LENGTH); 100 std::string ice_password = rtc::CreateRandomString(cricket::ICE_PWD_LENGTH);
101 channel_->SetIceProtocolType(cricket::ICEPROTO_RFC5245); 101 channel_->SetIceProtocolType(cricket::ICEPROTO_RFC5245);
102 channel_->SetIceRole((transport_context_->role() == TransportRole::CLIENT) 102 channel_->SetIceRole((transport_context_->role() == TransportRole::CLIENT)
103 ? cricket::ICEROLE_CONTROLLING 103 ? cricket::ICEROLE_CONTROLLING
104 : cricket::ICEROLE_CONTROLLED); 104 : cricket::ICEROLE_CONTROLLED);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 FROM_HERE, base::TimeDelta::FromSeconds(kReconnectDelaySeconds), 137 FROM_HERE, base::TimeDelta::FromSeconds(kReconnectDelaySeconds),
138 this, &IceTransportChannel::TryReconnect); 138 this, &IceTransportChannel::TryReconnect);
139 } 139 }
140 140
141 void IceTransportChannel::NotifyConnected() { 141 void IceTransportChannel::NotifyConnected() {
142 // Create P2PDatagramSocket adapter for the P2PTransportChannel. 142 // Create P2PDatagramSocket adapter for the P2PTransportChannel.
143 scoped_ptr<TransportChannelSocketAdapter> socket( 143 scoped_ptr<TransportChannelSocketAdapter> socket(
144 new TransportChannelSocketAdapter(channel_.get())); 144 new TransportChannelSocketAdapter(channel_.get()));
145 socket->SetOnDestroyedCallback(base::Bind( 145 socket->SetOnDestroyedCallback(base::Bind(
146 &IceTransportChannel::OnChannelDestroyed, base::Unretained(this))); 146 &IceTransportChannel::OnChannelDestroyed, base::Unretained(this)));
147 base::ResetAndReturn(&callback_).Run(socket.Pass()); 147 base::ResetAndReturn(&callback_).Run(std::move(socket));
148 } 148 }
149 149
150 void IceTransportChannel::SetRemoteCredentials(const std::string& ufrag, 150 void IceTransportChannel::SetRemoteCredentials(const std::string& ufrag,
151 const std::string& password) { 151 const std::string& password) {
152 DCHECK(thread_checker_.CalledOnValidThread()); 152 DCHECK(thread_checker_.CalledOnValidThread());
153 153
154 remote_ice_username_fragment_ = ufrag; 154 remote_ice_username_fragment_ = ufrag;
155 remote_ice_password_ = password; 155 remote_ice_password_ = password;
156 156
157 if (channel_) 157 if (channel_)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 // Restart ICE by resetting ICE password. 279 // Restart ICE by resetting ICE password.
280 std::string ice_password = rtc::CreateRandomString(cricket::ICE_PWD_LENGTH); 280 std::string ice_password = rtc::CreateRandomString(cricket::ICE_PWD_LENGTH);
281 delegate_->OnTransportIceCredentials(this, ice_username_fragment_, 281 delegate_->OnTransportIceCredentials(this, ice_username_fragment_,
282 ice_password); 282 ice_password);
283 channel_->SetIceCredentials(ice_username_fragment_, ice_password); 283 channel_->SetIceCredentials(ice_username_fragment_, ice_password);
284 } 284 }
285 285
286 } // namespace protocol 286 } // namespace protocol
287 } // namespace remoting 287 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698