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 #include "remoting/protocol/channel_multiplexer.h" | 5 #include "remoting/protocol/channel_multiplexer.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 MuxSocket* socket_; | 96 MuxSocket* socket_; |
97 std::list<PendingPacket*> pending_packets_; | 97 std::list<PendingPacket*> pending_packets_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(MuxChannel); | 99 DISALLOW_COPY_AND_ASSIGN(MuxChannel); |
100 }; | 100 }; |
101 | 101 |
102 class ChannelMultiplexer::MuxSocket : public net::StreamSocket, | 102 class ChannelMultiplexer::MuxSocket : public net::StreamSocket, |
103 public base::NonThreadSafe, | 103 public base::NonThreadSafe, |
104 public base::SupportsWeakPtr<MuxSocket> { | 104 public base::SupportsWeakPtr<MuxSocket> { |
105 public: | 105 public: |
106 MuxSocket(MuxChannel* channel); | 106 explicit MuxSocket(MuxChannel* channel); |
107 ~MuxSocket(); | 107 ~MuxSocket(); |
108 | 108 |
109 void OnWriteComplete(); | 109 void OnWriteComplete(); |
110 void OnWriteFailed(); | 110 void OnWriteFailed(); |
111 void OnPacketReceived(); | 111 void OnPacketReceived(); |
112 | 112 |
113 // net::StreamSocket interface. | 113 // net::StreamSocket interface. |
114 virtual int Read(net::IOBuffer* buffer, int buffer_len, | 114 virtual int Read(net::IOBuffer* buffer, int buffer_len, |
115 const net::CompletionCallback& callback) OVERRIDE; | 115 const net::CompletionCallback& callback) OVERRIDE; |
116 virtual int Write(net::IOBuffer* buffer, int buffer_len, | 116 virtual int Write(net::IOBuffer* buffer, int buffer_len, |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 channel->OnIncomingPacket(packet.Pass(), done_task); | 518 channel->OnIncomingPacket(packet.Pass(), done_task); |
519 } | 519 } |
520 | 520 |
521 bool ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, | 521 bool ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, |
522 const base::Closure& done_task) { | 522 const base::Closure& done_task) { |
523 return writer_.Write(SerializeAndFrameMessage(*packet), done_task); | 523 return writer_.Write(SerializeAndFrameMessage(*packet), done_task); |
524 } | 524 } |
525 | 525 |
526 } // namespace protocol | 526 } // namespace protocol |
527 } // namespace remoting | 527 } // namespace remoting |
OLD | NEW |