summaryrefslogtreecommitdiffstats
path: root/remoting/signaling
diff options
context:
space:
mode:
authorsergeyu <sergeyu@chromium.org>2015-12-23 16:20:51 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-24 00:22:13 +0000
commit42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a (patch)
tree5d69f8f65e9c3b096bb03f0256b155c745925bed /remoting/signaling
parent2e53cb5448df90f11940a2e55ef6c74bd74ac3e7 (diff)
downloadchromium_src-42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a.zip
chromium_src-42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a.tar.gz
chromium_src-42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a.tar.bz2
Use std::move() instead of .Pass() in remoting/*
Now there is a presubmit check that doesn't allow Pass() anymore. See https://www.chromium.org/rvalue-references for information about std::move in chromium. Review URL: https://codereview.chromium.org/1545723002 Cr-Commit-Position: refs/heads/master@{#366778}
Diffstat (limited to 'remoting/signaling')
-rw-r--r--remoting/signaling/fake_signal_strategy.cc4
-rw-r--r--remoting/signaling/iq_sender.cc10
-rw-r--r--remoting/signaling/iq_sender_unittest.cc9
-rw-r--r--remoting/signaling/jingle_info_request.cc7
-rw-r--r--remoting/signaling/log_to_server.cc11
-rw-r--r--remoting/signaling/server_log_entry.cc2
-rw-r--r--remoting/signaling/xmpp_login_handler.cc4
-rw-r--r--remoting/signaling/xmpp_login_handler_unittest.cc4
-rw-r--r--remoting/signaling/xmpp_signal_strategy.cc9
-rw-r--r--remoting/signaling/xmpp_signal_strategy_unittest.cc9
-rw-r--r--remoting/signaling/xmpp_stream_parser_unittest.cc4
11 files changed, 44 insertions, 29 deletions
diff --git a/remoting/signaling/fake_signal_strategy.cc b/remoting/signaling/fake_signal_strategy.cc
index 996845c..4acb424 100644
--- a/remoting/signaling/fake_signal_strategy.cc
+++ b/remoting/signaling/fake_signal_strategy.cc
@@ -4,6 +4,8 @@
#include "remoting/signaling/fake_signal_strategy.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
@@ -107,7 +109,7 @@ bool FakeSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) {
FROM_HERE, base::Bind(peer_callback_, base::Passed(&stanza)),
send_delay_);
} else {
- peer_callback_.Run(stanza.Pass());
+ peer_callback_.Run(std::move(stanza));
}
return true;
} else {
diff --git a/remoting/signaling/iq_sender.cc b/remoting/signaling/iq_sender.cc
index 9e54340..498fdb5 100644
--- a/remoting/signaling/iq_sender.cc
+++ b/remoting/signaling/iq_sender.cc
@@ -4,6 +4,8 @@
#include "remoting/signaling/iq_sender.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/location.h"
@@ -30,7 +32,7 @@ scoped_ptr<buzz::XmlElement> IqSender::MakeIqStanza(
if (!addressee.empty())
stanza->AddAttr(buzz::QN_TO, addressee);
stanza->AddElement(iq_body.release());
- return stanza.Pass();
+ return stanza;
}
IqSender::IqSender(SignalStrategy* signal_strategy)
@@ -47,21 +49,21 @@ scoped_ptr<IqRequest> IqSender::SendIq(scoped_ptr<buzz::XmlElement> stanza,
std::string addressee = stanza->Attr(buzz::QN_TO);
std::string id = signal_strategy_->GetNextId();
stanza->AddAttr(buzz::QN_ID, id);
- if (!signal_strategy_->SendStanza(stanza.Pass())) {
+ if (!signal_strategy_->SendStanza(std::move(stanza))) {
return nullptr;
}
DCHECK(requests_.find(id) == requests_.end());
scoped_ptr<IqRequest> request(new IqRequest(this, callback, addressee));
if (!callback.is_null())
requests_[id] = request.get();
- return request.Pass();
+ return request;
}
scoped_ptr<IqRequest> IqSender::SendIq(const std::string& type,
const std::string& addressee,
scoped_ptr<buzz::XmlElement> iq_body,
const ReplyCallback& callback) {
- return SendIq(MakeIqStanza(type, addressee, iq_body.Pass()), callback);
+ return SendIq(MakeIqStanza(type, addressee, std::move(iq_body)), callback);
}
void IqSender::RemoveRequest(IqRequest* request) {
diff --git a/remoting/signaling/iq_sender_unittest.cc b/remoting/signaling/iq_sender_unittest.cc
index 6302a29..aa025dc 100644
--- a/remoting/signaling/iq_sender_unittest.cc
+++ b/remoting/signaling/iq_sender_unittest.cc
@@ -2,12 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "remoting/signaling/iq_sender.h"
+
+#include <utility>
+
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
-#include "remoting/signaling/iq_sender.h"
#include "remoting/signaling/mock_signal_strategy.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -64,7 +67,7 @@ class IqSenderTest : public testing::Test {
.WillOnce(Return(kStanzaId));
EXPECT_CALL(signal_strategy_, SendStanzaPtr(_))
.WillOnce(DoAll(SaveArg<0>(&sent_stanza), Return(true)));
- request_ = sender_->SendIq(kType, kTo, iq_body.Pass(), base::Bind(
+ request_ = sender_->SendIq(kType, kTo, std::move(iq_body), base::Bind(
&MockCallback::OnReply, base::Unretained(&callback_)));
std::string expected_xml_string =
@@ -93,7 +96,7 @@ class IqSenderTest : public testing::Test {
bool result = sender_->OnSignalStrategyIncomingStanza(response.get());
if (response_out)
- *response_out = response.Pass();
+ *response_out = std::move(response);
return result;
}
diff --git a/remoting/signaling/jingle_info_request.cc b/remoting/signaling/jingle_info_request.cc
index be0f75f..0ea7517 100644
--- a/remoting/signaling/jingle_info_request.cc
+++ b/remoting/signaling/jingle_info_request.cc
@@ -4,6 +4,8 @@
#include "remoting/signaling/jingle_info_request.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/stl_util.h"
@@ -20,8 +22,7 @@ namespace remoting {
const int kRequestTimeoutSeconds = 5;
JingleInfoRequest::JingleInfoRequest(SignalStrategy* signal_strategy)
- : iq_sender_(signal_strategy) {
-}
+ : iq_sender_(signal_strategy) {}
JingleInfoRequest::~JingleInfoRequest() {}
@@ -30,7 +31,7 @@ void JingleInfoRequest::Send(const OnJingleInfoCallback& callback) {
scoped_ptr<buzz::XmlElement> iq_body(
new buzz::XmlElement(buzz::QN_JINGLE_INFO_QUERY, true));
request_ = iq_sender_.SendIq(
- buzz::STR_GET, buzz::STR_EMPTY, iq_body.Pass(),
+ buzz::STR_GET, buzz::STR_EMPTY, std::move(iq_body),
base::Bind(&JingleInfoRequest::OnResponse, base::Unretained(this)));
if (!request_) {
// If we failed to send IqRequest it means that SignalStrategy is
diff --git a/remoting/signaling/log_to_server.cc b/remoting/signaling/log_to_server.cc
index 731dc58..2da454f 100644
--- a/remoting/signaling/log_to_server.cc
+++ b/remoting/signaling/log_to_server.cc
@@ -4,6 +4,8 @@
#include "remoting/signaling/log_to_server.h"
+#include <utility>
+
#include "remoting/base/constants.h"
#include "remoting/signaling/iq_sender.h"
#include "remoting/signaling/signal_strategy.h"
@@ -63,12 +65,9 @@ void LogToServer::SendPendingEntries() {
stanza->AddElement(entry.ToStanza().release());
pending_entries_.pop_front();
}
- // Send the stanza to the server.
- scoped_ptr<IqRequest> req = iq_sender_->SendIq(
- buzz::STR_SET, directory_bot_jid_, stanza.Pass(),
- IqSender::ReplyCallback());
- // We ignore any response, so let the IqRequest be destroyed.
- return;
+ // Send the stanza to the server and ignore the response.
+ iq_sender_->SendIq(buzz::STR_SET, directory_bot_jid_, std::move(stanza),
+ IqSender::ReplyCallback());
}
} // namespace remoting
diff --git a/remoting/signaling/server_log_entry.cc b/remoting/signaling/server_log_entry.cc
index d91a32a..9eda8931 100644
--- a/remoting/signaling/server_log_entry.cc
+++ b/remoting/signaling/server_log_entry.cc
@@ -82,7 +82,7 @@ scoped_ptr<XmlElement> ServerLogEntry::ToStanza() const {
for (iter = values_map_.begin(); iter != values_map_.end(); ++iter) {
stanza->AddAttr(QName(std::string(), iter->first), iter->second);
}
- return stanza.Pass();
+ return stanza;
}
} // namespace remoting
diff --git a/remoting/signaling/xmpp_login_handler.cc b/remoting/signaling/xmpp_login_handler.cc
index 448ecbe..dc12382 100644
--- a/remoting/signaling/xmpp_login_handler.cc
+++ b/remoting/signaling/xmpp_login_handler.cc
@@ -4,6 +4,8 @@
#include "remoting/signaling/xmpp_login_handler.h"
+#include <utility>
+
#include "base/base64.h"
#include "base/bind.h"
#include "base/logging.h"
@@ -182,7 +184,7 @@ void XmppLoginHandler::OnStanza(scoped_ptr<buzz::XmlElement> stanza) {
return;
}
state_ = State::DONE;
- delegate_->OnHandshakeDone(jid_, stream_parser_.Pass());
+ delegate_->OnHandshakeDone(jid_, std::move(stream_parser_));
break;
default:
diff --git a/remoting/signaling/xmpp_login_handler_unittest.cc b/remoting/signaling/xmpp_login_handler_unittest.cc
index ab9abe0..125a8ac 100644
--- a/remoting/signaling/xmpp_login_handler_unittest.cc
+++ b/remoting/signaling/xmpp_login_handler_unittest.cc
@@ -4,6 +4,8 @@
#include "remoting/signaling/xmpp_login_handler.h"
+#include <utility>
+
#include "base/base64.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -51,7 +53,7 @@ class XmppLoginHandlerTest : public testing::Test,
void OnHandshakeDone(const std::string& jid,
scoped_ptr<XmppStreamParser> parser) override {
jid_ = jid;
- parser_ = parser.Pass();
+ parser_ = std::move(parser);
if (delete_login_handler_from_delegate_)
login_handler_.reset();
}
diff --git a/remoting/signaling/xmpp_signal_strategy.cc b/remoting/signaling/xmpp_signal_strategy.cc
index 7577df7..fbc5373 100644
--- a/remoting/signaling/xmpp_signal_strategy.cc
+++ b/remoting/signaling/xmpp_signal_strategy.cc
@@ -4,6 +4,7 @@
#include "remoting/signaling/xmpp_signal_strategy.h"
+#include <utility>
#include <vector>
#include "base/bind.h"
@@ -286,7 +287,7 @@ void XmppSignalStrategy::Core::StartTls() {
scoped_ptr<net::ClientSocketHandle> socket_handle(
new net::ClientSocketHandle());
- socket_handle->SetSocket(socket_.Pass());
+ socket_handle->SetSocket(std::move(socket_));
cert_verifier_ = net::CertVerifier::CreateDefault();
transport_security_state_.reset(new net::TransportSecurityState());
@@ -295,7 +296,7 @@ void XmppSignalStrategy::Core::StartTls() {
context.transport_security_state = transport_security_state_.get();
socket_ = socket_factory_->CreateSSLClientSocket(
- socket_handle.Pass(),
+ std::move(socket_handle),
net::HostPortPair(xmpp_server_config_.host, kDefaultHttpsPort),
net::SSLConfig(), context);
@@ -311,7 +312,7 @@ void XmppSignalStrategy::Core::OnHandshakeDone(
DCHECK(thread_checker_.CalledOnValidThread());
jid_ = jid;
- stream_parser_ = parser.Pass();
+ stream_parser_ = std::move(parser);
stream_parser_->SetCallbacks(
base::Bind(&Core::OnStanza, base::Unretained(this)),
base::Bind(&Core::OnParserError, base::Unretained(this)));
@@ -523,7 +524,7 @@ void XmppSignalStrategy::RemoveListener(Listener* listener) {
core_->RemoveListener(listener);
}
bool XmppSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) {
- return core_->SendStanza(stanza.Pass());
+ return core_->SendStanza(std::move(stanza));
}
std::string XmppSignalStrategy::GetNextId() {
diff --git a/remoting/signaling/xmpp_signal_strategy_unittest.cc b/remoting/signaling/xmpp_signal_strategy_unittest.cc
index 82a2ed8..fcfdce7 100644
--- a/remoting/signaling/xmpp_signal_strategy_unittest.cc
+++ b/remoting/signaling/xmpp_signal_strategy_unittest.cc
@@ -4,6 +4,8 @@
#include "remoting/signaling/xmpp_signal_strategy.h"
+#include <utility>
+
#include "base/base64.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -94,7 +96,7 @@ class MockClientSocketFactory : public net::MockClientSocketFactory {
const net::SSLClientSocketContext& context) override {
ssl_socket_created_ = true;
return net::MockClientSocketFactory::CreateSSLClientSocket(
- transport_socket.Pass(), host_and_port, ssl_config, context);
+ std::move(transport_socket), host_and_port, ssl_config, context);
}
bool ssl_socket_created() const { return ssl_socket_created_; }
@@ -115,10 +117,9 @@ class XmppSignalStrategyTest : public testing::Test,
XmppSignalStrategyTest() : message_loop_(base::MessageLoop::TYPE_IO) {}
void SetUp() override {
- scoped_ptr<net::TestURLRequestContext> context(
- new net::TestURLRequestContext());
request_context_getter_ = new net::TestURLRequestContextGetter(
- message_loop_.task_runner(), context.Pass());
+ message_loop_.task_runner(),
+ make_scoped_ptr(new net::TestURLRequestContext()));
}
void CreateSignalStrategy(int port) {
diff --git a/remoting/signaling/xmpp_stream_parser_unittest.cc b/remoting/signaling/xmpp_stream_parser_unittest.cc
index a76e02c..0bd2d31 100644
--- a/remoting/signaling/xmpp_stream_parser_unittest.cc
+++ b/remoting/signaling/xmpp_stream_parser_unittest.cc
@@ -4,6 +4,8 @@
#include "remoting/signaling/xmpp_stream_parser.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop.h"
@@ -30,7 +32,7 @@ class XmppStreamParserTest : public testing::Test {
}
void OnStanza(scoped_ptr<buzz::XmlElement> stanza) {
- received_stanzas_.push_back(stanza.Pass());
+ received_stanzas_.push_back(std::move(stanza));
}
void OnError() {