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

Side by Side Diff: remoting/signaling/xmpp_signal_strategy.cc

Issue 1545723002: Use std::move() instead of .Pass() in remoting/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass_host
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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/signaling/xmpp_signal_strategy.h" 5 #include "remoting/signaling/xmpp_signal_strategy.h"
6 6
7 #include <utility>
7 #include <vector> 8 #include <vector>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/location.h" 11 #include "base/location.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/observer_list.h" 14 #include "base/observer_list.h"
14 #include "base/rand_util.h" 15 #include "base/rand_util.h"
15 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
16 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 280
280 tls_state_ = TlsState::CONNECTING; 281 tls_state_ = TlsState::CONNECTING;
281 282
282 // Reset the writer so we don't try to write to the raw socket anymore. 283 // Reset the writer so we don't try to write to the raw socket anymore.
283 writer_.reset(); 284 writer_.reset();
284 285
285 DCHECK(!read_pending_); 286 DCHECK(!read_pending_);
286 287
287 scoped_ptr<net::ClientSocketHandle> socket_handle( 288 scoped_ptr<net::ClientSocketHandle> socket_handle(
288 new net::ClientSocketHandle()); 289 new net::ClientSocketHandle());
289 socket_handle->SetSocket(socket_.Pass()); 290 socket_handle->SetSocket(std::move(socket_));
290 291
291 cert_verifier_ = net::CertVerifier::CreateDefault(); 292 cert_verifier_ = net::CertVerifier::CreateDefault();
292 transport_security_state_.reset(new net::TransportSecurityState()); 293 transport_security_state_.reset(new net::TransportSecurityState());
293 net::SSLClientSocketContext context; 294 net::SSLClientSocketContext context;
294 context.cert_verifier = cert_verifier_.get(); 295 context.cert_verifier = cert_verifier_.get();
295 context.transport_security_state = transport_security_state_.get(); 296 context.transport_security_state = transport_security_state_.get();
296 297
297 socket_ = socket_factory_->CreateSSLClientSocket( 298 socket_ = socket_factory_->CreateSSLClientSocket(
298 socket_handle.Pass(), 299 std::move(socket_handle),
299 net::HostPortPair(xmpp_server_config_.host, kDefaultHttpsPort), 300 net::HostPortPair(xmpp_server_config_.host, kDefaultHttpsPort),
300 net::SSLConfig(), context); 301 net::SSLConfig(), context);
301 302
302 int result = socket_->Connect( 303 int result = socket_->Connect(
303 base::Bind(&Core::OnTlsConnected, base::Unretained(this))); 304 base::Bind(&Core::OnTlsConnected, base::Unretained(this)));
304 if (result != net::ERR_IO_PENDING) 305 if (result != net::ERR_IO_PENDING)
305 OnTlsConnected(result); 306 OnTlsConnected(result);
306 } 307 }
307 308
308 void XmppSignalStrategy::Core::OnHandshakeDone( 309 void XmppSignalStrategy::Core::OnHandshakeDone(
309 const std::string& jid, 310 const std::string& jid,
310 scoped_ptr<XmppStreamParser> parser) { 311 scoped_ptr<XmppStreamParser> parser) {
311 DCHECK(thread_checker_.CalledOnValidThread()); 312 DCHECK(thread_checker_.CalledOnValidThread());
312 313
313 jid_ = jid; 314 jid_ = jid;
314 stream_parser_ = parser.Pass(); 315 stream_parser_ = std::move(parser);
315 stream_parser_->SetCallbacks( 316 stream_parser_->SetCallbacks(
316 base::Bind(&Core::OnStanza, base::Unretained(this)), 317 base::Bind(&Core::OnStanza, base::Unretained(this)),
317 base::Bind(&Core::OnParserError, base::Unretained(this))); 318 base::Bind(&Core::OnParserError, base::Unretained(this)));
318 319
319 // Don't need |login_handler_| anymore. 320 // Don't need |login_handler_| anymore.
320 login_handler_.reset(); 321 login_handler_.reset();
321 322
322 FOR_EACH_OBSERVER(Listener, listeners_, 323 FOR_EACH_OBSERVER(Listener, listeners_,
323 OnSignalStrategyStateChange(CONNECTED)); 324 OnSignalStrategyStateChange(CONNECTED));
324 } 325 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 } 517 }
517 518
518 void XmppSignalStrategy::AddListener(Listener* listener) { 519 void XmppSignalStrategy::AddListener(Listener* listener) {
519 core_->AddListener(listener); 520 core_->AddListener(listener);
520 } 521 }
521 522
522 void XmppSignalStrategy::RemoveListener(Listener* listener) { 523 void XmppSignalStrategy::RemoveListener(Listener* listener) {
523 core_->RemoveListener(listener); 524 core_->RemoveListener(listener);
524 } 525 }
525 bool XmppSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) { 526 bool XmppSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) {
526 return core_->SendStanza(stanza.Pass()); 527 return core_->SendStanza(std::move(stanza));
527 } 528 }
528 529
529 std::string XmppSignalStrategy::GetNextId() { 530 std::string XmppSignalStrategy::GetNextId() {
530 return base::Uint64ToString(base::RandUint64()); 531 return base::Uint64ToString(base::RandUint64());
531 } 532 }
532 533
533 void XmppSignalStrategy::SetAuthInfo(const std::string& username, 534 void XmppSignalStrategy::SetAuthInfo(const std::string& username,
534 const std::string& auth_token) { 535 const std::string& auth_token) {
535 core_->SetAuthInfo(username, auth_token); 536 core_->SetAuthInfo(username, auth_token);
536 } 537 }
537 538
538 } // namespace remoting 539 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/signaling/xmpp_login_handler_unittest.cc ('k') | remoting/signaling/xmpp_signal_strategy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698