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

Unified Diff: remoting/protocol/jingle_session_manager.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/jingle_session_manager.cc
diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc
index 60d84e7280d96f08be4674230cb5c61e28a21a52..b92f0f4b9ccb5268b7af02918bae94c217fdd7c4 100644
--- a/remoting/protocol/jingle_session_manager.cc
+++ b/remoting/protocol/jingle_session_manager.cc
@@ -122,10 +122,10 @@ void JingleSessionManager::set_authenticator_factory(
authenticator_factory_ = authenticator_factory.Pass();
}
-Session* JingleSessionManager::Connect(
+scoped_ptr<Session> JingleSessionManager::Connect(
const std::string& host_jid,
- Authenticator* authenticator,
- CandidateSessionConfig* candidate_config,
+ scoped_ptr<Authenticator> authenticator,
+ scoped_ptr<CandidateSessionConfig> config,
const Session::StateChangeCallback& state_change_callback) {
DCHECK(CalledOnValidThread());
@@ -133,15 +133,15 @@ Session* JingleSessionManager::Connect(
signal_strategy_->GetLocalJid(), kChromotingXmlNamespace);
cricket_session->set_remote_name(host_jid);
- JingleSession* jingle_session =
- new JingleSession(this, cricket_session, authenticator);
- jingle_session->set_candidate_config(candidate_config);
+ scoped_ptr<JingleSession> jingle_session(
+ new JingleSession(this, cricket_session, authenticator.Pass()));
+ jingle_session->set_candidate_config(config.Pass());
jingle_session->SetStateChangeCallback(state_change_callback);
- sessions_.push_back(jingle_session);
+ sessions_.push_back(jingle_session.get());
jingle_session->SendSessionInitiate();
- return jingle_session;
+ return scoped_ptr<Session>(jingle_session.Pass());
Wez 2012/01/19 23:23:41 This doesn't seem too painful; at least it works!
Sergey Ulanov 2012/01/19 23:50:26 Yeah, I'm also considering adding PassAs<>(), with
Wez 2012/01/19 23:56:57 That's a good idea. :)
}
void JingleSessionManager::OnSessionCreate(
@@ -153,7 +153,7 @@ void JingleSessionManager::OnSessionCreate(
if (incoming) {
JingleSession* jingle_session =
- new JingleSession(this, cricket_session, NULL);
+ new JingleSession(this, cricket_session, scoped_ptr<Authenticator>());
sessions_.push_back(jingle_session);
}
}
@@ -198,12 +198,12 @@ SessionManager::IncomingSessionResponse JingleSessionManager::AcceptConnection(
return response;
}
-Authenticator* JingleSessionManager::CreateAuthenticator(
+scoped_ptr<Authenticator> JingleSessionManager::CreateAuthenticator(
const std::string& jid, const buzz::XmlElement* auth_message) {
DCHECK(CalledOnValidThread());
if (!authenticator_factory_.get())
- return NULL;
+ return scoped_ptr<Authenticator>(NULL);
return authenticator_factory_->CreateAuthenticator(jid, auth_message);
}

Powered by Google App Engine
This is Rietveld 408576698