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

Unified Diff: remoting/protocol/jingle_session.cc

Issue 7796026: Pass SessionConfig by reference instead of pointer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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.cc
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 3a906e23f321228b85b856e769125346aa06b396..b30101c1244ee932064c33d4eb53c6925630da6f 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -57,6 +57,7 @@ JingleSession::JingleSession(
state_(INITIALIZING),
closing_(false),
cricket_session_(NULL),
+ config_set_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
// TODO(hclam): Need a better way to clone a key.
if (local_private_key) {
@@ -164,10 +165,7 @@ net::Socket* JingleSession::event_channel() {
}
const std::string& JingleSession::jid() {
- // TODO(sergeyu): Fix ChromotingHost so that it doesn't call this
- // method on invalid thread and uncomment this DCHECK.
- // See crbug.com/88600 .
- // DCHECK(CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
return jid_;
}
@@ -190,20 +188,17 @@ const std::string& JingleSession::local_certificate() const {
return local_cert_;
}
-const SessionConfig* JingleSession::config() {
- // TODO(sergeyu): Fix ChromotingHost so that it doesn't call this
- // method on invalid thread and uncomment this DCHECK.
- // See crbug.com/88600 .
- // DCHECK(CalledOnValidThread());
- DCHECK(config_.get());
- return config_.get();
+const SessionConfig& JingleSession::config() {
+ DCHECK(CalledOnValidThread());
+ DCHECK(config_set_);
+ return config_;
}
-void JingleSession::set_config(const SessionConfig* config) {
+void JingleSession::set_config(const SessionConfig& config) {
DCHECK(CalledOnValidThread());
- DCHECK(!config_.get());
- DCHECK(config);
- config_.reset(config);
+ DCHECK(!config_set_);
+ config_ = config;
+ config_set_ = true;
}
const std::string& JingleSession::initiator_token() {
@@ -339,18 +334,17 @@ bool JingleSession::InitializeConfigFromDescription(
return false;
}
- scoped_ptr<SessionConfig> config(
- content_description->config()->GetFinalConfig());
- if (!config.get()) {
+ SessionConfig config;
+ if (!content_description->config()->GetFinalConfig(&config)) {
LOG(ERROR) << "Connection response does not specify configuration";
return false;
}
- if (!candidate_config()->IsSupported(config.get())) {
+ if (!candidate_config()->IsSupported(config)) {
LOG(ERROR) << "Connection response specifies an invalid configuration";
return false;
}
- set_config(config.release());
+ set_config(config);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698