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

Unified Diff: remoting/protocol/jingle_session.h

Issue 1545743002: Move ownership of Transport out of Session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass_client
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.h
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index 25d5c439cdd68c6df3b7b8fe9b90fef8f2614a4b..dc80defa0edc1a6f016b5fb0fa12626c0e564a23 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -10,7 +10,7 @@
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "crypto/rsa_private_key.h"
#include "net/base/completion_callback.h"
@@ -19,20 +19,18 @@
#include "remoting/protocol/jingle_messages.h"
#include "remoting/protocol/session.h"
#include "remoting/protocol/session_config.h"
-#include "remoting/protocol/transport.h"
#include "remoting/signaling/iq_sender.h"
namespace remoting {
namespace protocol {
class JingleSessionManager;
+class Transport;
// 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 Transport::EventHandler {
+class JingleSession : public Session {
public:
~JingleSession() override;
@@ -41,7 +39,7 @@ class JingleSession : public base::NonThreadSafe,
ErrorCode error() override;
const std::string& jid() override;
const SessionConfig& config() override;
- Transport* GetTransport() override;
+ void SetTransport(Transport* transport) override;
void Close(protocol::ErrorCode error) override;
private:
@@ -60,6 +58,9 @@ class JingleSession : public base::NonThreadSafe,
scoped_ptr<Authenticator> authenticator);
void AcceptIncomingConnection(const JingleMessage& initiate_message);
+ // Callback for Transport interface to send transport-info messages.
+ void SendTransportInfo(scoped_ptr<buzz::XmlElement> transport_info);
+
// Sends |message| to the peer. The session is closed if the send fails or no
// response is received within a reasonable time. All other responses are
// ignored.
@@ -70,14 +71,6 @@ class JingleSession : public base::NonThreadSafe,
IqRequest* request,
const buzz::XmlElement* response);
- // Transport::EventHandler interface.
- void OnOutgoingTransportInfo(
- scoped_ptr<buzz::XmlElement> transport_info) override;
- void OnTransportRouteChange(const std::string& component,
- const TransportRoute& route) override;
- void OnTransportConnected() override;
- void OnTransportError(ErrorCode error) override;
-
// Response handler for transport-info responses. Transport-info timeouts are
// ignored and don't terminate connection.
void OnTransportInfoResponse(IqRequest* request,
@@ -118,6 +111,8 @@ class JingleSession : public base::NonThreadSafe,
// Returns true if the state of the session is not CLOSED or FAILED
bool is_session_active();
+ base::ThreadChecker thread_checker_;
+
JingleSessionManager* session_manager_;
std::string peer_jid_;
Session::EventHandler* event_handler_;
@@ -130,7 +125,7 @@ class JingleSession : public base::NonThreadSafe,
scoped_ptr<Authenticator> authenticator_;
- scoped_ptr<Transport> transport_;
+ Transport* transport_ = nullptr;
// Pending Iq requests. Used for all messages except transport-info.
std::set<IqRequest*> pending_requests_;

Powered by Google App Engine
This is Rietveld 408576698