| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_STREAM_WRITER_H_ | 5 #ifndef REMOTING_PROTOCOL_STREAM_WRITER_H_ |
| 6 #define REMOTING_PROTOCOL_STREAM_WRITER_H_ | 6 #define REMOTING_PROTOCOL_STREAM_WRITER_H_ |
| 7 | 7 |
| 8 #include "base/ref_counted.h" |
| 8 #include "remoting/proto/internal.pb.h" | 9 #include "remoting/proto/internal.pb.h" |
| 9 #include "remoting/protocol/buffered_socket_writer.h" | 10 |
| 11 namespace net { |
| 12 class Socket; |
| 13 } // namespace net |
| 10 | 14 |
| 11 namespace remoting { | 15 namespace remoting { |
| 12 | 16 |
| 13 class ChromotingConnection; | 17 class BufferedSocketWriter; |
| 14 | 18 |
| 15 class StreamWriterBase { | 19 class StreamWriterBase { |
| 16 public: | 20 public: |
| 17 StreamWriterBase(); | 21 StreamWriterBase(); |
| 18 virtual ~StreamWriterBase(); | 22 virtual ~StreamWriterBase(); |
| 19 | 23 |
| 20 // Initializes the writer. Must be called on the thread the |socket| belongs | 24 // Initializes the writer. Must be called on the thread the |socket| belongs |
| 21 // to. | 25 // to. |
| 22 void Init(net::Socket* socket); | 26 void Init(net::Socket* socket); |
| 23 | 27 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 scoped_refptr<BufferedSocketWriter> buffered_writer_; | 38 scoped_refptr<BufferedSocketWriter> buffered_writer_; |
| 35 }; | 39 }; |
| 36 | 40 |
| 37 class EventStreamWriter : public StreamWriterBase { | 41 class EventStreamWriter : public StreamWriterBase { |
| 38 public: | 42 public: |
| 39 // Sends the |message| or returns false if called before Init(). | 43 // Sends the |message| or returns false if called before Init(). |
| 40 // Can be called on any thread. | 44 // Can be called on any thread. |
| 41 bool SendMessage(const ChromotingClientMessage& message); | 45 bool SendMessage(const ChromotingClientMessage& message); |
| 42 }; | 46 }; |
| 43 | 47 |
| 44 class VideoStreamWriter : public StreamWriterBase { | 48 class ControlStreamWriter : public StreamWriterBase { |
| 45 public: | 49 public: |
| 46 // Sends the |message| or returns false if called before Init(). | 50 // Sends the |message| or returns false if called before Init(). |
| 47 // Can be called on any thread. | 51 // Can be called on any thread. |
| 48 bool SendMessage(const ChromotingHostMessage& message); | 52 bool SendMessage(const ChromotingHostMessage& message); |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 } // namespace remoting | 55 } // namespace remoting |
| 52 | 56 |
| 53 #endif // REMOTING_PROTOCOL_STREAM_WRITER_H_ | 57 #endif // REMOTING_PROTOCOL_STREAM_WRITER_H_ |
| OLD | NEW |