| OLD | NEW |
| 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/proto/mux.pb.h" | 9 #include "remoting/proto/mux.pb.h" |
| 10 #include "remoting/protocol/buffered_socket_writer.h" | 10 #include "remoting/protocol/buffered_socket_writer.h" |
| 11 #include "remoting/protocol/message_reader.h" | 11 #include "remoting/protocol/message_reader.h" |
| 12 #include "remoting/protocol/protobuf_message_parser.h" |
| 12 #include "remoting/protocol/stream_channel_factory.h" | 13 #include "remoting/protocol/stream_channel_factory.h" |
| 13 | 14 |
| 14 namespace remoting { | 15 namespace remoting { |
| 15 namespace protocol { | 16 namespace protocol { |
| 16 | 17 |
| 17 class ChannelMultiplexer : public StreamChannelFactory { | 18 class ChannelMultiplexer : public StreamChannelFactory { |
| 18 public: | 19 public: |
| 19 static const char kMuxChannelName[]; | 20 static const char kMuxChannelName[]; |
| 20 | 21 |
| 21 // |factory| is used to create the channel upon which to multiplex. | 22 // |factory| is used to create the channel upon which to multiplex. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 std::list<PendingChannel> pending_channels_; | 72 std::list<PendingChannel> pending_channels_; |
| 72 | 73 |
| 73 int next_channel_id_; | 74 int next_channel_id_; |
| 74 std::map<std::string, MuxChannel*> channels_; | 75 std::map<std::string, MuxChannel*> channels_; |
| 75 | 76 |
| 76 // Channels are added to |channels_by_receive_id_| only after we receive | 77 // Channels are added to |channels_by_receive_id_| only after we receive |
| 77 // receive_id from the remote peer. | 78 // receive_id from the remote peer. |
| 78 std::map<int, MuxChannel*> channels_by_receive_id_; | 79 std::map<int, MuxChannel*> channels_by_receive_id_; |
| 79 | 80 |
| 80 BufferedSocketWriter writer_; | 81 BufferedSocketWriter writer_; |
| 81 ProtobufMessageReader<MultiplexPacket> reader_; | 82 MessageReader reader_; |
| 83 ProtobufMessageParser<MultiplexPacket> parser_; |
| 82 | 84 |
| 83 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; | 85 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; |
| 84 | 86 |
| 85 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); | 87 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 } // namespace protocol | 90 } // namespace protocol |
| 89 } // namespace remoting | 91 } // namespace remoting |
| 90 | 92 |
| 91 | 93 |
| 92 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ | 94 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
| OLD | NEW |