Chromium Code Reviews| Index: remoting/protocol/channel_multiplexer.h |
| diff --git a/remoting/protocol/channel_multiplexer.h b/remoting/protocol/channel_multiplexer.h |
| index 0f16fb16da0d877c0a05e510b71ed4a68f13f84a..c93d66d2b0105ab8797e51846c3499d083ae35e5 100644 |
| --- a/remoting/protocol/channel_multiplexer.h |
| +++ b/remoting/protocol/channel_multiplexer.h |
| @@ -5,6 +5,7 @@ |
| #ifndef REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
| #define REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
| +#include "base/memory/weak_ptr.h" |
| #include "remoting/proto/mux.pb.h" |
| #include "remoting/protocol/buffered_socket_writer.h" |
| #include "remoting/protocol/channel_factory.h" |
| @@ -40,11 +41,19 @@ class ChannelMultiplexer : public ChannelFactory { |
| // Callback for |base_channel_| creation. |
| void OnBaseChannelReady(scoped_ptr<net::StreamSocket> socket); |
| + // Helper to create channels asynchronously. |
| + void DoCreatePendingChannels(); |
| + |
| // Helper method used to create channels. |
| MuxChannel* GetOrCreateChannel(const std::string& name); |
| - // Callbacks for |writer_| and |reader_|. |
| + // Callback for |writer_|. |
|
Wez
2012/09/25 17:43:58
nit: Error handling callback for |writer_|.
Sergey Ulanov
2012/09/25 18:59:08
Done.
|
| void OnWriteFailed(int error); |
| + |
| + // Helper to notify channels about failed write. |
|
Wez
2012/09/25 17:43:58
nit: Clarify why this is separate from OnWriteFail
Sergey Ulanov
2012/09/25 18:59:08
Done.
|
| + void NotifyWriteFailed(const std::string& name); |
| + |
| + // Callback for |reader_; |
| void OnIncomingPacket(scoped_ptr<MultiplexPacket> packet, |
| const base::Closure& done_task); |
| @@ -75,8 +84,7 @@ class ChannelMultiplexer : public ChannelFactory { |
| BufferedSocketWriter writer_; |
| ProtobufMessageReader<MultiplexPacket> reader_; |
| - // Flag used by OnWriteFailed() to detect when the multiplexer is destroyed. |
| - bool* destroyed_flag_; |
| + base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; |
| DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); |
| }; |