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

Unified Diff: remoting/protocol/transport.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
« no previous file with comments | « remoting/protocol/session.h ('k') | remoting/protocol/transport.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/transport.h
diff --git a/remoting/protocol/transport.h b/remoting/protocol/transport.h
index 99aab7b5e2f2a939f77629333da535a7b9e0ced2..c9f24d36fa9ed8363cb7c3a27adb2c6ca0c45f89 100644
--- a/remoting/protocol/transport.h
+++ b/remoting/protocol/transport.h
@@ -14,10 +14,6 @@
#include "net/base/ip_endpoint.h"
#include "remoting/protocol/errors.h"
-namespace cricket {
-class Candidate;
-} // namespace cricket
-
namespace buzz {
class XmlElement;
} // namespace buzz
@@ -33,7 +29,6 @@ class Authenticator;
class DatagramChannelFactory;
class P2PDatagramSocket;
class StreamChannelFactory;
-class WebrtcTransport;
enum class TransportRole {
SERVER,
@@ -58,68 +53,22 @@ struct TransportRoute {
net::IPEndPoint local_address;
};
-// Transport represents a P2P connection that consists of one or more
-// channels.
+// Transport represents a P2P connection that consists of one or more channels.
+// This interface is used just to send and receive transport-info messages.
+// Implementations should provide other methods to send and receive data.
class Transport {
public:
- class EventHandler {
- public:
- // Called to send a transport-info message.
- virtual void OnOutgoingTransportInfo(
- scoped_ptr<buzz::XmlElement> message) = 0;
-
- // Called when transport route changes.
- virtual void OnTransportRouteChange(const std::string& channel_name,
- const TransportRoute& route) = 0;
-
- // Called when the transport is connected.
- virtual void OnTransportConnected() = 0;
-
- // Called when there is an error connecting the session.
- virtual void OnTransportError(ErrorCode error) = 0;
- };
+ typedef base::Callback<void(scoped_ptr<buzz::XmlElement> transport_info)>
+ SendTransportInfoCallback;
- Transport() {}
virtual ~Transport() {}
- // Starts transport session. Both parameters must outlive Transport.
- virtual void Start(EventHandler* event_handler,
- Authenticator* authenticator) = 0;
-
- // Called to process incoming transport message. Returns false if
- // |transport_info| is in invalid format.
+ // Sets the object responsible for delivering outgoing transport-info messages
+ // to the peer.
+ virtual void Start(
+ Authenticator* authenticator,
+ SendTransportInfoCallback send_transport_info_callback) = 0;
virtual bool ProcessTransportInfo(buzz::XmlElement* transport_info) = 0;
-
- // Channel factory for the session that creates stream channels.
- virtual StreamChannelFactory* GetStreamChannelFactory() = 0;
-
- // Returns a factory that creates multiplexed channels over a single stream
- // channel.
- virtual StreamChannelFactory* GetMultiplexedChannelFactory() = 0;
-
- // Returns the transport as WebrtcTransport or nullptr if this is not a
- // WebrtcTransport.
- //
- // TODO(sergeyu): Move creation and ownership of Transport objects to the
- // Connection classes. That way the Connection classes will be able to ensure
- // that correct transport implementation is used for the connection and this
- // method will not be necessary.
- virtual WebrtcTransport* AsWebrtcTransport();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Transport);
-};
-
-class TransportFactory {
- public:
- TransportFactory() { }
- virtual ~TransportFactory() { }
-
- // Creates a new Transport. The factory must outlive the session.
- virtual scoped_ptr<Transport> CreateTransport() = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TransportFactory);
};
} // namespace protocol
« no previous file with comments | « remoting/protocol/session.h ('k') | remoting/protocol/transport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698