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

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

Issue 1197853003: Add P2PDatagramSocket and P2PStreamSocket interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.cc ('k') | remoting/protocol/channel_multiplexer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CHANNEL_MULTIPLEXER_H_ 5 #ifndef REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_
6 #define REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ 6 #define REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "remoting/base/buffered_socket_writer.h" 9 #include "remoting/base/buffered_socket_writer.h"
10 #include "remoting/proto/mux.pb.h" 10 #include "remoting/proto/mux.pb.h"
(...skipping 18 matching lines...) Expand all
29 const ChannelCreatedCallback& callback) override; 29 const ChannelCreatedCallback& callback) override;
30 void CancelChannelCreation(const std::string& name) override; 30 void CancelChannelCreation(const std::string& name) override;
31 31
32 private: 32 private:
33 struct PendingChannel; 33 struct PendingChannel;
34 class MuxChannel; 34 class MuxChannel;
35 class MuxSocket; 35 class MuxSocket;
36 friend class MuxChannel; 36 friend class MuxChannel;
37 37
38 // Callback for |base_channel_| creation. 38 // Callback for |base_channel_| creation.
39 void OnBaseChannelReady(scoped_ptr<net::StreamSocket> socket); 39 void OnBaseChannelReady(scoped_ptr<P2PStreamSocket> socket);
40 40
41 // Helper to create channels asynchronously. 41 // Helper to create channels asynchronously.
42 void DoCreatePendingChannels(); 42 void DoCreatePendingChannels();
43 43
44 // Helper method used to create channels. 44 // Helper method used to create channels.
45 MuxChannel* GetOrCreateChannel(const std::string& name); 45 MuxChannel* GetOrCreateChannel(const std::string& name);
46 46
47 // Error handling callback for |reader_| and |writer_|. 47 // Error handling callback for |reader_| and |writer_|.
48 void OnBaseChannelError(int error); 48 void OnBaseChannelError(int error);
49 49
(...skipping 10 matching lines...) Expand all
60 const base::Closure& done_task); 60 const base::Closure& done_task);
61 61
62 // Factory used to create |base_channel_|. Set to nullptr once creation is 62 // Factory used to create |base_channel_|. Set to nullptr once creation is
63 // finished or failed. 63 // finished or failed.
64 StreamChannelFactory* base_channel_factory_; 64 StreamChannelFactory* base_channel_factory_;
65 65
66 // Name of the underlying channel. 66 // Name of the underlying channel.
67 std::string base_channel_name_; 67 std::string base_channel_name_;
68 68
69 // The channel over which to multiplex. 69 // The channel over which to multiplex.
70 scoped_ptr<net::StreamSocket> base_channel_; 70 scoped_ptr<P2PStreamSocket> base_channel_;
71 71
72 // List of requested channels while we are waiting for |base_channel_|. 72 // List of requested channels while we are waiting for |base_channel_|.
73 std::list<PendingChannel> pending_channels_; 73 std::list<PendingChannel> pending_channels_;
74 74
75 int next_channel_id_; 75 int next_channel_id_;
76 std::map<std::string, MuxChannel*> channels_; 76 std::map<std::string, MuxChannel*> channels_;
77 77
78 // Channels are added to |channels_by_receive_id_| only after we receive 78 // Channels are added to |channels_by_receive_id_| only after we receive
79 // receive_id from the remote peer. 79 // receive_id from the remote peer.
80 std::map<int, MuxChannel*> channels_by_receive_id_; 80 std::map<int, MuxChannel*> channels_by_receive_id_;
81 81
82 BufferedSocketWriter writer_; 82 BufferedSocketWriter writer_;
83 MessageReader reader_; 83 MessageReader reader_;
84 ProtobufMessageParser<MultiplexPacket> parser_; 84 ProtobufMessageParser<MultiplexPacket> parser_;
85 85
86 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; 86 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_;
87 87
88 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); 88 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer);
89 }; 89 };
90 90
91 } // namespace protocol 91 } // namespace protocol
92 } // namespace remoting 92 } // namespace remoting
93 93
94 94
95 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ 95 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.cc ('k') | remoting/protocol/channel_multiplexer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698