| 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_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/lock.h" | |
| 11 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "base/synchronization/lock.h" |
| 12 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.h" |
| 13 #include "net/socket/socket.h" | 13 #include "net/socket/socket.h" |
| 14 | 14 |
| 15 class MessageLoop; | 15 class MessageLoop; |
| 16 class Task; | 16 class Task; |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 class Socket; | 19 class Socket; |
| 20 } // namespace net | 20 } // namespace net |
| 21 | 21 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 virtual void OnError_Locked(int result) = 0; | 79 virtual void OnError_Locked(int result) = 0; |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 void DoWrite(); | 82 void DoWrite(); |
| 83 void OnWritten(int result); | 83 void OnWritten(int result); |
| 84 | 84 |
| 85 // This method is called when an error is encountered. | 85 // This method is called when an error is encountered. |
| 86 void HandleError(int result); | 86 void HandleError(int result); |
| 87 | 87 |
| 88 // Must be locked when accessing |socket_|, |queue_| and |buffer_size_|; | 88 // Must be locked when accessing |socket_|, |queue_| and |buffer_size_|; |
| 89 Lock lock_; | 89 base::Lock lock_; |
| 90 | 90 |
| 91 net::Socket* socket_; | 91 net::Socket* socket_; |
| 92 MessageLoop* message_loop_; | 92 MessageLoop* message_loop_; |
| 93 scoped_ptr<WriteFailedCallback> write_failed_callback_; | 93 scoped_ptr<WriteFailedCallback> write_failed_callback_; |
| 94 | 94 |
| 95 bool write_pending_; | 95 bool write_pending_; |
| 96 | 96 |
| 97 net::CompletionCallbackImpl<BufferedSocketWriterBase> written_callback_; | 97 net::CompletionCallbackImpl<BufferedSocketWriterBase> written_callback_; |
| 98 | 98 |
| 99 bool closed_; | 99 bool closed_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 121 protected: | 121 protected: |
| 122 virtual void GetNextPacket_Locked(net::IOBuffer** buffer, int* size); | 122 virtual void GetNextPacket_Locked(net::IOBuffer** buffer, int* size); |
| 123 virtual void AdvanceBufferPosition_Locked(int written); | 123 virtual void AdvanceBufferPosition_Locked(int written); |
| 124 virtual void OnError_Locked(int result); | 124 virtual void OnError_Locked(int result); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 } // namespace protocol | 127 } // namespace protocol |
| 128 } // namespace remoting | 128 } // namespace remoting |
| 129 | 129 |
| 130 #endif // REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ | 130 #endif // REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ |
| OLD | NEW |