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

Unified Diff: remoting/protocol/jingle_session_manager.cc

Issue 1530523002: More cleanups in JingleSessionManager interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@transport_context
Patch Set: Created 5 years 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 f6e87fd22e0cce55833c250d8ed6694d9b69ecfd..544cfc3fedcf658fc8d07a0b0b6684b7c21201fb 100644
--- a/remoting/protocol/jingle_session_manager.cc
+++ b/remoting/protocol/jingle_session_manager.cc
@@ -21,22 +21,24 @@ namespace remoting {
namespace protocol {
JingleSessionManager::JingleSessionManager(
- scoped_ptr<TransportFactory> transport_factory)
- : protocol_config_(CandidateSessionConfig::CreateDefault()),
- transport_factory_(transport_factory.Pass()) {}
+ scoped_ptr<TransportFactory> transport_factory,
+ SignalStrategy* signal_strategy)
+ : transport_factory_(transport_factory.Pass()),
+ signal_strategy_(signal_strategy),
+ protocol_config_(CandidateSessionConfig::CreateDefault()),
+ iq_sender_(new IqSender(signal_strategy_)) {
+ signal_strategy_->AddListener(this);
+}
JingleSessionManager::~JingleSessionManager() {
- Close();
+ DCHECK(sessions_.empty());
+ signal_strategy_->RemoveListener(this);
}
-void JingleSessionManager::Init(
- SignalStrategy* signal_strategy,
- SessionManager::Listener* listener) {
- listener_ = listener;
- signal_strategy_ = signal_strategy;
- iq_sender_.reset(new IqSender(signal_strategy_));
+void JingleSessionManager::AcceptIncoming(
+ const IncomingSessionCallback& incoming_session_callback) {
+ incoming_session_callback_ = incoming_session_callback;
Jamie 2015/12/15 00:32:01 DCHECK(incoming_session_callback_.is_null())? Or i
Sergey Ulanov 2015/12/16 23:17:39 Yeah, I don't think there are any issues with this
- signal_strategy_->AddListener(this);
}
void JingleSessionManager::set_protocol_config(
@@ -53,20 +55,6 @@ scoped_ptr<Session> JingleSessionManager::Connect(
return session.Pass();
}
-void JingleSessionManager::Close() {
- DCHECK(CalledOnValidThread());
-
- // Close() can be called only after all sessions are destroyed.
- DCHECK(sessions_.empty());
-
- listener_ = nullptr;
-
- if (signal_strategy_) {
- signal_strategy_->RemoveListener(this);
- signal_strategy_ = nullptr;
- }
-}
-
void JingleSessionManager::set_authenticator_factory(
scoped_ptr<AuthenticatorFactory> authenticator_factory) {
DCHECK(CalledOnValidThread());
@@ -111,7 +99,8 @@ bool JingleSessionManager::OnSignalStrategyIncomingStanza(
}
IncomingSessionResponse response = SessionManager::DECLINE;
- listener_->OnIncomingSession(session, &response);
+ if (!incoming_session_callback_.is_null())
+ incoming_session_callback_.Run(session, &response);
if (response == SessionManager::ACCEPT) {
session->AcceptIncomingConnection(message);

Powered by Google App Engine
This is Rietveld 408576698