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

Unified Diff: remoting/protocol/webrtc_data_stream_adapter.h

Issue 2164163002: Simplify data channel creation logic in WebRTC-based protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « remoting/protocol/webrtc_connection_to_host.cc ('k') | remoting/protocol/webrtc_data_stream_adapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_data_stream_adapter.h
diff --git a/remoting/protocol/webrtc_data_stream_adapter.h b/remoting/protocol/webrtc_data_stream_adapter.h
index 48c4c0f45603155b604d8811625acad1d7700525..f3cf7cb9e85484a82f88c5665cdd002ae342c28b 100644
--- a/remoting/protocol/webrtc_data_stream_adapter.h
+++ b/remoting/protocol/webrtc_data_stream_adapter.h
@@ -5,6 +5,7 @@
#ifndef REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_
#define REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_
+#include <memory>
#include <string>
#include "base/callback.h"
@@ -23,48 +24,24 @@ namespace protocol {
// WebrtcDataStreamAdapter is a MessageChannelFactory that creates channels that
Jamie 2016/07/22 01:10:16 Update the comment.
Sergey Ulanov 2016/07/22 01:20:37 Done.
// send and receive messages over PeerConnection data channels.
-class WebrtcDataStreamAdapter : public MessageChannelFactory {
+class WebrtcDataStreamAdapter {
public:
typedef base::Callback<void(ErrorCode)> ErrorCallback;
- explicit WebrtcDataStreamAdapter(const ErrorCallback& error_callback);
- ~WebrtcDataStreamAdapter() override;
-
- // Initializes the adapter for |peer_connection|. If |outgoing| is set to true
- // all channels will be created as outgoing. Otherwise CreateChannel() will
- // wait for the other end to create connection.
- void Initialize(
+ WebrtcDataStreamAdapter(
Jamie 2016/07/22 01:10:16 Why not explicit any more?
Sergey Ulanov 2016/07/22 01:20:37 Done.
rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection);
+ ~WebrtcDataStreamAdapter();
- // Called by WebrtcTransport.
- void WrapIncomingDataChannel(
- rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel,
- const ChannelCreatedCallback& callback);
+ // Creates outgoing data channel.
+ std::unique_ptr<MessagePipe> CreateOutgoingChannel(const std::string& name);
- // MessageChannelFactory interface.
- void CreateChannel(const std::string& name,
- const ChannelCreatedCallback& callback) override;
- void CancelChannelCreation(const std::string& name) override;
+ // Creates incoming data channel.
+ std::unique_ptr<MessagePipe> WrapIncomingDataChannel(
+ rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel);
private:
- class Channel;
- friend class Channel;
-
- struct PendingChannel;
-
- void AddPendingChannel(
- rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel,
- const ChannelCreatedCallback& callback);
-
- void OnChannelConnected(Channel* channel);
- void OnChannelError();
-
- ErrorCallback error_callback_;
-
rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
- std::map<std::string, PendingChannel> pending_channels_;
-
DISALLOW_COPY_AND_ASSIGN(WebrtcDataStreamAdapter);
};
« no previous file with comments | « remoting/protocol/webrtc_connection_to_host.cc ('k') | remoting/protocol/webrtc_data_stream_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698