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

Unified Diff: remoting/protocol/jingle_session.h

Issue 1420273002: Add TransportSession interface to prepare for WebRTC-based transport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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.h
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index 68678687e47f1b5f8c46dd8ef49b83edba29de7d..9e595afec091aaa3235604d082a03135608650fa 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -6,11 +6,11 @@
#define REMOTING_PROTOCOL_JINGLE_SESSION_H_
#include <list>
-#include <map>
#include <set>
#include <string>
#include "base/memory/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
#include "base/timer/timer.h"
#include "crypto/rsa_private_key.h"
#include "net/base/completion_callback.h"
@@ -25,19 +25,15 @@
namespace remoting {
namespace protocol {
-class ChannelMultiplexer;
class JingleSessionManager;
-class PseudoTcpChannelFactory;
class QuicChannelFactory;
-class SecureChannelFactory;
// JingleSessionManager and JingleSession implement the subset of the
// Jingle protocol used in Chromoting. Instances of this class are
// created by the JingleSessionManager.
class JingleSession : public base::NonThreadSafe,
public Session,
- public DatagramChannelFactory,
- public Transport::EventHandler {
+ public TransportSession::EventHandler {
public:
~JingleSession() override;
@@ -46,31 +42,13 @@ class JingleSession : public base::NonThreadSafe,
ErrorCode error() override;
const std::string& jid() override;
const SessionConfig& config() override;
- StreamChannelFactory* GetTransportChannelFactory() override;
- StreamChannelFactory* GetMultiplexedChannelFactory() override;
+ TransportSession* GetTransportSession() override;
StreamChannelFactory* GetQuicChannelFactory() override;
Sergey Ulanov 2015/10/23 19:35:21 Note that this can potentially be moved to Transpo
void Close() override;
- // DatagramChannelFactory interface.
- void CreateChannel(const std::string& name,
- const ChannelCreatedCallback& callback) override;
- void CancelChannelCreation(const std::string& name) override;
-
- // Transport::EventHandler interface.
- void OnTransportIceCredentials(Transport* transport,
- const std::string& ufrag,
- const std::string& password) override;
- void OnTransportCandidate(Transport* transport,
- const cricket::Candidate& candidate) override;
- void OnTransportRouteChange(Transport* transport,
- const TransportRoute& route) override;
- void OnTransportFailed(Transport* transport) override;
- void OnTransportDeleted(Transport* transport) override;
-
private:
friend class JingleSessionManager;
- typedef std::map<std::string, Transport*> ChannelsMap;
typedef base::Callback<void(JingleMessageReply::ErrorType)> ReplyCallback;
explicit JingleSession(JingleSessionManager* session_manager);
@@ -79,10 +57,6 @@ class JingleSession : public base::NonThreadSafe,
void StartConnection(const std::string& peer_jid,
scoped_ptr<Authenticator> authenticator);
- // Passes transport info to a new |channel| in case it was received before the
- // channel was created.
- void AddPendingRemoteTransportInfo(Transport* channel);
-
// Called by JingleSessionManager for incoming connections.
void InitializeIncomingConnection(const JingleMessage& initiate_message,
scoped_ptr<Authenticator> authenticator);
@@ -98,12 +72,12 @@ class JingleSession : public base::NonThreadSafe,
IqRequest* request,
const buzz::XmlElement* response);
- // Creates empty |pending_transport_info_message_| and schedules timer for
- // SentTransportInfo() to sent the message later.
- void EnsurePendingTransportInfoMessage();
-
- // Sends transport-info message with candidates from |pending_candidates_|.
- void SendTransportInfo();
+ // TransportSession::Delegate interface.
+ void OnOutgoingTransportInfo(
+ scoped_ptr<buzz::XmlElement> transport_info) override;
+ void OnTransportRouteChange(const std::string& component,
+ const TransportRoute& route) override;
+ void OnTransportError(ErrorCode error) override;
// Response handler for transport-info responses. Transport-info timeouts are
// ignored and don't terminate connection.
@@ -123,7 +97,6 @@ class JingleSession : public base::NonThreadSafe,
const ReplyCallback& reply_callback);
void OnTerminate(const JingleMessage& message,
const ReplyCallback& reply_callback);
- void ProcessTransportInfo(const JingleMessage& message);
// Called from OnAccept() to initialize session config.
bool InitializeConfigFromDescription(const ContentDescription* description);
@@ -163,26 +136,16 @@ class JingleSession : public base::NonThreadSafe,
scoped_ptr<Authenticator> authenticator_;
+ scoped_ptr<TransportSession> transport_session_;
+
// Pending Iq requests. Used for all messages except transport-info.
std::set<IqRequest*> pending_requests_;
// Pending transport-info requests.
std::list<IqRequest*> transport_info_requests_;
- ChannelsMap channels_;
- scoped_ptr<PseudoTcpChannelFactory> pseudotcp_channel_factory_;
- scoped_ptr<SecureChannelFactory> secure_channel_factory_;
- scoped_ptr<ChannelMultiplexer> channel_multiplexer_;
scoped_ptr<QuicChannelFactory> quic_channel_factory_;
- scoped_ptr<JingleMessage> pending_transport_info_message_;
- base::OneShotTimer transport_info_timer_;
-
- // Pending remote transport info received before the local channels were
- // created.
- std::list<JingleMessage::IceCredentials> pending_remote_ice_credentials_;
- std::list<JingleMessage::NamedCandidate> pending_remote_candidates_;
-
base::WeakPtrFactory<JingleSession> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(JingleSession);

Powered by Google App Engine
This is Rietveld 408576698