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

Unified Diff: remoting/protocol/fake_authenticator.cc

Issue 9240033: Use scoped_ptr<>.Pass() to pass ownership in the remoting protocol code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 11 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
Index: remoting/protocol/fake_authenticator.cc
diff --git a/remoting/protocol/fake_authenticator.cc b/remoting/protocol/fake_authenticator.cc
index 559122125a910853a1e43c884a91fe6bc65bdeee..4be9b7418efa9982dde9ecb128ab525d78d53f91 100644
--- a/remoting/protocol/fake_authenticator.cc
+++ b/remoting/protocol/fake_authenticator.cc
@@ -97,24 +97,25 @@ void FakeAuthenticator::ProcessMessage(const buzz::XmlElement* message) {
++messages_;
}
-buzz::XmlElement* FakeAuthenticator::GetNextMessage() {
+scoped_ptr<buzz::XmlElement> FakeAuthenticator::GetNextMessage() {
EXPECT_EQ(MESSAGE_READY, state());
- buzz::XmlElement* result = new buzz::XmlElement(
- buzz::QName(kChromotingXmlNamespace, "authentication"));
+ scoped_ptr<buzz::XmlElement> result(new buzz::XmlElement(
+ buzz::QName(kChromotingXmlNamespace, "authentication")));
buzz::XmlElement* id = new buzz::XmlElement(
buzz::QName(kChromotingXmlNamespace, "id"));
id->AddText(base::IntToString(messages_));
result->AddElement(id);
++messages_;
- return result;
+ return result.Pass();
}
-ChannelAuthenticator*
+scoped_ptr<ChannelAuthenticator>
FakeAuthenticator::CreateChannelAuthenticator() const {
EXPECT_EQ(ACCEPTED, state());
- return new FakeChannelAuthenticator(action_ != REJECT_CHANNEL, async_);
+ return scoped_ptr<ChannelAuthenticator>(
+ new FakeChannelAuthenticator(action_ != REJECT_CHANNEL, async_));
}
FakeHostAuthenticatorFactory::FakeHostAuthenticatorFactory(
@@ -126,11 +127,11 @@ FakeHostAuthenticatorFactory::FakeHostAuthenticatorFactory(
FakeHostAuthenticatorFactory::~FakeHostAuthenticatorFactory() {
}
-Authenticator* FakeHostAuthenticatorFactory::CreateAuthenticator(
+scoped_ptr<Authenticator> FakeHostAuthenticatorFactory::CreateAuthenticator(
const std::string& remote_jid,
const buzz::XmlElement* first_message) {
- return new FakeAuthenticator(FakeAuthenticator::HOST, round_trips_,
- action_, async_);
+ return scoped_ptr<Authenticator>(new FakeAuthenticator(
+ FakeAuthenticator::HOST, round_trips_, action_, async_));
}
} // namespace protocol

Powered by Google App Engine
This is Rietveld 408576698