Chromium Code Reviews| Index: remoting/protocol/jingle_session.cc |
| diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc |
| index 814e09ffbb99322806476e32b130a0b43ede5e87..7521dc0a3e644a4b5fc7cd450a1cf6f24d668d24 100644 |
| --- a/remoting/protocol/jingle_session.cc |
| +++ b/remoting/protocol/jingle_session.cc |
| @@ -13,6 +13,7 @@ |
| #include "remoting/jingle_glue/iq_sender.h" |
| #include "remoting/protocol/authenticator.h" |
| #include "remoting/protocol/channel_authenticator.h" |
| +#include "remoting/protocol/channel_multiplexer.h" |
| #include "remoting/protocol/content_description.h" |
| #include "remoting/protocol/jingle_messages.h" |
| #include "remoting/protocol/jingle_session_manager.h" |
| @@ -38,6 +39,9 @@ const int kTransportInfoSendDelayMs = 2; |
| // |transport-info|. |
| const int kMessageResponseTimeoutSeconds = 10; |
| +// Name of the multiplexed channel. |
| +const char kMuxChannelName[] = "mux"; |
| + |
| ErrorCode AuthRejectionReasonToErrorCode( |
| Authenticator::RejectionReason reason) { |
| switch (reason) { |
| @@ -61,6 +65,7 @@ JingleSession::JingleSession(JingleSessionManager* session_manager) |
| } |
| JingleSession::~JingleSession() { |
| + channel_multiplexer_.reset(); |
| STLDeleteContainerPointers(pending_requests_.begin(), |
| pending_requests_.end()); |
| STLDeleteContainerPairSecondPointers(channels_.begin(), channels_.end()); |
| @@ -170,6 +175,44 @@ void JingleSession::AcceptIncomingConnection( |
| return; |
| } |
| +const std::string& JingleSession::jid() { |
| + DCHECK(CalledOnValidThread()); |
| + return peer_jid_; |
| +} |
| + |
| +const CandidateSessionConfig* JingleSession::candidate_config() { |
| + DCHECK(CalledOnValidThread()); |
| + return candidate_config_.get(); |
| +} |
| + |
| +const SessionConfig& JingleSession::config() { |
| + DCHECK(CalledOnValidThread()); |
| + return config_; |
| +} |
| + |
| +void JingleSession::set_config(const SessionConfig& config) { |
| + DCHECK(CalledOnValidThread()); |
| + DCHECK(!config_is_set_); |
| + config_ = config; |
| + config_is_set_ = true; |
| +} |
| + |
| +ChannelFactory* JingleSession::GetTransportChannelFactory() { |
|
Wez
2012/08/18 00:30:36
nit: CalledOnValidThread?
Sergey Ulanov
2012/08/18 01:53:56
Done.
|
| + return this; |
| +} |
| + |
| +ChannelFactory* JingleSession::GetMultiplexedChannelFactory() { |
|
Wez
2012/08/18 00:30:36
nit: CalledOnValidThread?
Sergey Ulanov
2012/08/18 01:53:56
Done.
|
| + if (!channel_multiplexer_.get()) |
| + channel_multiplexer_.reset(new ChannelMultiplexer(this, kMuxChannelName)); |
| + return channel_multiplexer_.get(); |
| +} |
| + |
| +void JingleSession::Close() { |
| + DCHECK(CalledOnValidThread()); |
| + |
| + CloseInternal(OK); |
| +} |
| + |
| void JingleSession::CreateStreamChannel( |
| const std::string& name, |
| const StreamChannelCallback& callback) { |
| @@ -206,34 +249,6 @@ void JingleSession::CancelChannelCreation(const std::string& name) { |
| } |
| } |
| -const std::string& JingleSession::jid() { |
| - DCHECK(CalledOnValidThread()); |
| - return peer_jid_; |
| -} |
| - |
| -const CandidateSessionConfig* JingleSession::candidate_config() { |
| - DCHECK(CalledOnValidThread()); |
| - return candidate_config_.get(); |
| -} |
| - |
| -const SessionConfig& JingleSession::config() { |
| - DCHECK(CalledOnValidThread()); |
| - return config_; |
| -} |
| - |
| -void JingleSession::set_config(const SessionConfig& config) { |
| - DCHECK(CalledOnValidThread()); |
| - DCHECK(!config_is_set_); |
| - config_ = config; |
| - config_is_set_ = true; |
| -} |
| - |
| -void JingleSession::Close() { |
| - DCHECK(CalledOnValidThread()); |
| - |
| - CloseInternal(OK); |
| -} |
| - |
| void JingleSession::OnTransportCandidate(Transport* transport, |
| const cricket::Candidate& candidate) { |
| pending_candidates_.push_back(JingleMessage::NamedCandidate( |