| 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/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 26 matching lines...) Expand all Loading... |
| 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<net::StreamSocket> 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 |writer_|. | 47 // Error handling callback for |reader_| and |writer_|. |
| 48 void OnWriteFailed(int error); | 48 void OnBaseChannelError(int error); |
| 49 | 49 |
| 50 // Failed write notifier, queued asynchronously by OnWriteFailed(). | 50 // Propagates base channel error to channel |name|, queued asynchronously by |
| 51 void NotifyWriteFailed(const std::string& name); | 51 // OnBaseChannelError(). |
| 52 void NotifyBaseChannelError(const std::string& name, int error); |
| 52 | 53 |
| 53 // Callback for |reader_; | 54 // Callback for |reader_; |
| 54 void OnIncomingPacket(scoped_ptr<MultiplexPacket> packet, | 55 void OnIncomingPacket(scoped_ptr<MultiplexPacket> packet, |
| 55 const base::Closure& done_task); | 56 const base::Closure& done_task); |
| 56 | 57 |
| 57 // Called by MuxChannel. | 58 // Called by MuxChannel. |
| 58 bool DoWrite(scoped_ptr<MultiplexPacket> packet, | 59 bool DoWrite(scoped_ptr<MultiplexPacket> packet, |
| 59 const base::Closure& done_task); | 60 const base::Closure& done_task); |
| 60 | 61 |
| 61 // 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 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 85 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; | 86 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; |
| 86 | 87 |
| 87 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); | 88 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace protocol | 91 } // namespace protocol |
| 91 } // namespace remoting | 92 } // namespace remoting |
| 92 | 93 |
| 93 | 94 |
| 94 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ | 95 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
| OLD | NEW |