Commit 46c8e539 authored by Joey Scarr's avatar Joey Scarr Committed by Commit Bot

Minor clean-ups in remoting/signaling.

In response to post-commit comments on https://crrev.com/c/2050408.

Bug: 1007827,1007826
Change-Id: I4ef3aeb5ae586ad19c40db7d2c656e011bdf382a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2062016Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Commit-Queue: Joey Scarr <jsca@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742855}
parent f17ed629
...@@ -347,8 +347,8 @@ void JingleSession::SendTransportInfo( ...@@ -347,8 +347,8 @@ void JingleSession::SendTransportInfo(
stanza->AddAttr(jingle_xmpp::QN_ID, GetNextOutgoingId()); stanza->AddAttr(jingle_xmpp::QN_ID, GetNextOutgoingId());
auto request = session_manager_->iq_sender()->SendIq( auto request = session_manager_->iq_sender()->SendIq(
std::move(stanza), base::Bind(&JingleSession::OnTransportInfoResponse, std::move(stanza), base::BindOnce(&JingleSession::OnTransportInfoResponse,
base::Unretained(this))); base::Unretained(this)));
if (request) { if (request) {
request->SetTimeout(base::TimeDelta::FromSeconds(kTransportInfoTimeout)); request->SetTimeout(base::TimeDelta::FromSeconds(kTransportInfoTimeout));
transport_info_requests_.push_back(std::move(request)); transport_info_requests_.push_back(std::move(request));
...@@ -427,8 +427,9 @@ void JingleSession::SendMessage(std::unique_ptr<JingleMessage> message) { ...@@ -427,8 +427,9 @@ void JingleSession::SendMessage(std::unique_ptr<JingleMessage> message) {
stanza->AddAttr(jingle_xmpp::QN_ID, GetNextOutgoingId()); stanza->AddAttr(jingle_xmpp::QN_ID, GetNextOutgoingId());
auto request = session_manager_->iq_sender()->SendIq( auto request = session_manager_->iq_sender()->SendIq(
std::move(stanza), base::Bind(&JingleSession::OnMessageResponse, std::move(stanza),
base::Unretained(this), message->action)); base::BindOnce(&JingleSession::OnMessageResponse, base::Unretained(this),
message->action));
int timeout = kDefaultMessageTimeout; int timeout = kDefaultMessageTimeout;
if (message->action == JingleMessage::SESSION_INITIATE || if (message->action == JingleMessage::SESSION_INITIATE ||
......
...@@ -68,11 +68,12 @@ void FakeSignalStrategy::ConnectTo(FakeSignalStrategy* peer) { ...@@ -68,11 +68,12 @@ void FakeSignalStrategy::ConnectTo(FakeSignalStrategy* peer) {
base::BindRepeating(&FakeSignalStrategy::DeliverMessageOnThread, base::BindRepeating(&FakeSignalStrategy::DeliverMessageOnThread,
main_thread_, weak_factory_.GetWeakPtr()); main_thread_, weak_factory_.GetWeakPtr());
if (peer->main_thread_->BelongsToCurrentThread()) { if (peer->main_thread_->BelongsToCurrentThread()) {
peer->SetPeerCallback(peer_callback); peer->SetPeerCallback(std::move(peer_callback));
} else { } else {
peer->main_thread_->PostTask( peer->main_thread_->PostTask(
FROM_HERE, base::BindOnce(&FakeSignalStrategy::SetPeerCallback, FROM_HERE,
base::Unretained(peer), peer_callback)); base::BindOnce(&FakeSignalStrategy::SetPeerCallback,
base::Unretained(peer), std::move(peer_callback)));
} }
} }
......
...@@ -57,8 +57,8 @@ std::unique_ptr<IqRequest> IqSender::SendIq( ...@@ -57,8 +57,8 @@ std::unique_ptr<IqRequest> IqSender::SendIq(
} }
DCHECK(requests_.find(id) == requests_.end()); DCHECK(requests_.find(id) == requests_.end());
bool callback_exists = !callback.is_null(); bool callback_exists = !callback.is_null();
std::unique_ptr<IqRequest> request( auto request =
new IqRequest(this, std::move(callback), addressee)); std::make_unique<IqRequest>(this, std::move(callback), addressee);
if (callback_exists) if (callback_exists)
requests_[id] = request.get(); requests_[id] = request.get();
return request; return request;
......
...@@ -34,9 +34,9 @@ class IqSender : public SignalStrategy::Listener { ...@@ -34,9 +34,9 @@ class IqSender : public SignalStrategy::Listener {
public: public:
// Callback that is called when an Iq response is received. Called // Callback that is called when an Iq response is received. Called
// with the |response| set to nullptr in case of a timeout. // with the |response| set to nullptr in case of a timeout.
typedef base::OnceCallback<void(IqRequest* request, using ReplyCallback =
const jingle_xmpp::XmlElement* response)> base::OnceCallback<void(IqRequest* request,
ReplyCallback; const jingle_xmpp::XmlElement* response)>;
explicit IqSender(SignalStrategy* signal_strategy); explicit IqSender(SignalStrategy* signal_strategy);
~IqSender() override; ~IqSender() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment