| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BUFFERED_SOCKET_WRITER_H_ | 5 #ifndef REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ |
| 6 #define REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ | 6 #define REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 14 #include "net/socket/socket.h" | 14 #include "net/socket/socket.h" |
| 15 | 15 |
| 16 class Task; | |
| 17 | |
| 18 namespace base { | 16 namespace base { |
| 19 class MessageLoopProxy; | 17 class MessageLoopProxy; |
| 20 } // namespace base | 18 } // namespace base |
| 21 | 19 |
| 22 namespace net { | 20 namespace net { |
| 23 class Socket; | 21 class Socket; |
| 24 } // namespace net | 22 } // namespace net |
| 25 | 23 |
| 26 namespace remoting { | 24 namespace remoting { |
| 27 namespace protocol { | 25 namespace protocol { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 99 |
| 102 bool write_pending_; | 100 bool write_pending_; |
| 103 | 101 |
| 104 net::OldCompletionCallbackImpl<BufferedSocketWriterBase> written_callback_; | 102 net::OldCompletionCallbackImpl<BufferedSocketWriterBase> written_callback_; |
| 105 | 103 |
| 106 bool closed_; | 104 bool closed_; |
| 107 }; | 105 }; |
| 108 | 106 |
| 109 class BufferedSocketWriter : public BufferedSocketWriterBase { | 107 class BufferedSocketWriter : public BufferedSocketWriterBase { |
| 110 public: | 108 public: |
| 111 BufferedSocketWriter(base::MessageLoopProxy* message_loop); | 109 explicit BufferedSocketWriter(base::MessageLoopProxy* message_loop); |
| 112 virtual ~BufferedSocketWriter(); | 110 virtual ~BufferedSocketWriter(); |
| 113 | 111 |
| 114 protected: | 112 protected: |
| 115 virtual void GetNextPacket_Locked(net::IOBuffer** buffer, int* size); | 113 virtual void GetNextPacket_Locked(net::IOBuffer** buffer, int* size); |
| 116 virtual void AdvanceBufferPosition_Locked(int written); | 114 virtual void AdvanceBufferPosition_Locked(int written); |
| 117 virtual void OnError_Locked(int result); | 115 virtual void OnError_Locked(int result); |
| 118 | 116 |
| 119 private: | 117 private: |
| 120 scoped_refptr<net::DrainableIOBuffer> current_buf_; | 118 scoped_refptr<net::DrainableIOBuffer> current_buf_; |
| 121 }; | 119 }; |
| 122 | 120 |
| 123 class BufferedDatagramWriter : public BufferedSocketWriterBase { | 121 class BufferedDatagramWriter : public BufferedSocketWriterBase { |
| 124 public: | 122 public: |
| 125 BufferedDatagramWriter(base::MessageLoopProxy* message_loop); | 123 explicit BufferedDatagramWriter(base::MessageLoopProxy* message_loop); |
| 126 virtual ~BufferedDatagramWriter(); | 124 virtual ~BufferedDatagramWriter(); |
| 127 | 125 |
| 128 protected: | 126 protected: |
| 129 virtual void GetNextPacket_Locked(net::IOBuffer** buffer, int* size); | 127 virtual void GetNextPacket_Locked(net::IOBuffer** buffer, int* size); |
| 130 virtual void AdvanceBufferPosition_Locked(int written); | 128 virtual void AdvanceBufferPosition_Locked(int written); |
| 131 virtual void OnError_Locked(int result); | 129 virtual void OnError_Locked(int result); |
| 132 }; | 130 }; |
| 133 | 131 |
| 134 } // namespace protocol | 132 } // namespace protocol |
| 135 } // namespace remoting | 133 } // namespace remoting |
| 136 | 134 |
| 137 #endif // REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ | 135 #endif // REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ |
| OLD | NEW |