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

Side by Side Diff: remoting/protocol/webrtc_data_stream_adapter.h

Issue 1510333002: Cleanups in WebrtcTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_ 5 #ifndef REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_
6 #define REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_ 6 #define REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "remoting/protocol/stream_channel_factory.h" 12 #include "remoting/protocol/stream_channel_factory.h"
13 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h " 13 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h "
14 #include "third_party/webrtc/base/refcount.h" 14 #include "third_party/webrtc/base/refcount.h"
15 15
16 namespace rtc { 16 namespace rtc {
17 class PeerConnectionInterface; 17 class PeerConnectionInterface;
18 } // namespace rtc 18 } // namespace rtc
19 19
20 namespace remoting { 20 namespace remoting {
21 namespace protocol { 21 namespace protocol {
22 22
23 // WebrtcDataStreamAdapter is a StreamChannelFactory that creates channels that
24 // send and receive data over PeerConnection data channels.
23 class WebrtcDataStreamAdapter : public StreamChannelFactory { 25 class WebrtcDataStreamAdapter : public StreamChannelFactory {
24 public: 26 public:
25 WebrtcDataStreamAdapter(); 27 WebrtcDataStreamAdapter();
26 ~WebrtcDataStreamAdapter() override; 28 ~WebrtcDataStreamAdapter() override;
27 29
30 // Initializes the adapter for |peer_connection|. If |outgoing| is set to true
31 // all channels will be created as outgoing. Otherwise CreateChannel() will
32 // wait for the other end to create connection.
28 void Initialize( 33 void Initialize(
29 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection, 34 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection,
30 bool is_server); 35 bool outgoing);
31 36
37 // Called by WebrtcTransport.
32 void OnIncomingDataChannel(webrtc::DataChannelInterface* data_channel); 38 void OnIncomingDataChannel(webrtc::DataChannelInterface* data_channel);
33 39
34 // StreamChannelFactory interface. 40 // StreamChannelFactory interface.
35 void CreateChannel(const std::string& name, 41 void CreateChannel(const std::string& name,
36 const ChannelCreatedCallback& callback) override; 42 const ChannelCreatedCallback& callback) override;
37 void CancelChannelCreation(const std::string& name) override; 43 void CancelChannelCreation(const std::string& name) override;
38 44
39 private: 45 private:
40 class Channel; 46 class Channel;
41 47
42 void OnChannelConnected(const ChannelCreatedCallback& connected_callback, 48 void OnChannelConnected(const ChannelCreatedCallback& connected_callback,
43 Channel* channel, 49 Channel* channel,
44 bool connected); 50 bool connected);
45 51
46 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; 52 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
47 bool is_server_ = false; 53 bool outgoing_ = false;
48 54
49 std::map<std::string, Channel*> pending_channels_; 55 std::map<std::string, Channel*> pending_channels_;
50 56
51 base::WeakPtrFactory<WebrtcDataStreamAdapter> weak_factory_; 57 base::WeakPtrFactory<WebrtcDataStreamAdapter> weak_factory_;
52 58
53 DISALLOW_COPY_AND_ASSIGN(WebrtcDataStreamAdapter); 59 DISALLOW_COPY_AND_ASSIGN(WebrtcDataStreamAdapter);
54 }; 60 };
55 61
56 } // namespace protocol 62 } // namespace protocol
57 } // namespace remoting 63 } // namespace remoting
58 64
59 #endif // REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_ 65 #endif // REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/protocol/webrtc_data_stream_adapter.cc » ('j') | remoting/protocol/webrtc_transport.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698