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

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
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/jingle_session.cc
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 3a906e23f321228b85b856e769125346aa06b396..b80239c62ccb0796d9e69495b400079b69093d0c 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) {
@@ -190,20 +191,20 @@ const std::string& JingleSession::local_certificate() const {
return local_cert_;
}
-const SessionConfig* JingleSession::config() {
+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();
+ 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 +340,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;
}
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698