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

Unified Diff: remoting/signaling/iq_sender.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/signaling/iq_sender.h ('k') | remoting/signaling/iq_sender_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/signaling/iq_sender.cc
diff --git a/remoting/signaling/iq_sender.cc b/remoting/signaling/iq_sender.cc
index 498fdb5ea8546a7a0418872232420f84a0719d44..18530256b6a783f864c089901012fa0a9f9d1322 100644
--- a/remoting/signaling/iq_sender.cc
+++ b/remoting/signaling/iq_sender.cc
@@ -4,13 +4,13 @@
#include "remoting/signaling/iq_sender.h"
+#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/thread_task_runner_handle.h"
@@ -23,11 +23,11 @@
namespace remoting {
// static
-scoped_ptr<buzz::XmlElement> IqSender::MakeIqStanza(
+std::unique_ptr<buzz::XmlElement> IqSender::MakeIqStanza(
const std::string& type,
const std::string& addressee,
- scoped_ptr<buzz::XmlElement> iq_body) {
- scoped_ptr<buzz::XmlElement> stanza(new buzz::XmlElement(buzz::QN_IQ));
+ std::unique_ptr<buzz::XmlElement> iq_body) {
+ std::unique_ptr<buzz::XmlElement> stanza(new buzz::XmlElement(buzz::QN_IQ));
stanza->AddAttr(buzz::QN_TYPE, type);
if (!addressee.empty())
stanza->AddAttr(buzz::QN_TO, addressee);
@@ -44,8 +44,9 @@ IqSender::~IqSender() {
signal_strategy_->RemoveListener(this);
}
-scoped_ptr<IqRequest> IqSender::SendIq(scoped_ptr<buzz::XmlElement> stanza,
- const ReplyCallback& callback) {
+std::unique_ptr<IqRequest> IqSender::SendIq(
+ std::unique_ptr<buzz::XmlElement> stanza,
+ const ReplyCallback& callback) {
std::string addressee = stanza->Attr(buzz::QN_TO);
std::string id = signal_strategy_->GetNextId();
stanza->AddAttr(buzz::QN_ID, id);
@@ -53,16 +54,17 @@ scoped_ptr<IqRequest> IqSender::SendIq(scoped_ptr<buzz::XmlElement> stanza,
return nullptr;
}
DCHECK(requests_.find(id) == requests_.end());
- scoped_ptr<IqRequest> request(new IqRequest(this, callback, addressee));
+ std::unique_ptr<IqRequest> request(new IqRequest(this, callback, addressee));
if (!callback.is_null())
requests_[id] = request.get();
return request;
}
-scoped_ptr<IqRequest> IqSender::SendIq(const std::string& type,
- const std::string& addressee,
- scoped_ptr<buzz::XmlElement> iq_body,
- const ReplyCallback& callback) {
+std::unique_ptr<IqRequest> IqSender::SendIq(
+ const std::string& type,
+ const std::string& addressee,
+ std::unique_ptr<buzz::XmlElement> iq_body,
+ const ReplyCallback& callback) {
return SendIq(MakeIqStanza(type, addressee, std::move(iq_body)), callback);
}
@@ -153,13 +155,13 @@ void IqRequest::OnTimeout() {
void IqRequest::OnResponse(const buzz::XmlElement* stanza) {
// It's unsafe to delete signal strategy here, and the callback may
// want to do that, so we post task to invoke the callback later.
- scoped_ptr<buzz::XmlElement> stanza_copy(new buzz::XmlElement(*stanza));
+ std::unique_ptr<buzz::XmlElement> stanza_copy(new buzz::XmlElement(*stanza));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&IqRequest::DeliverResponse, AsWeakPtr(),
base::Passed(&stanza_copy)));
}
-void IqRequest::DeliverResponse(scoped_ptr<buzz::XmlElement> stanza) {
+void IqRequest::DeliverResponse(std::unique_ptr<buzz::XmlElement> stanza) {
CallCallback(stanza.get());
}
« no previous file with comments | « remoting/signaling/iq_sender.h ('k') | remoting/signaling/iq_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698