| 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 #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" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 int buffer_size_; | 66 int buffer_size_; |
| 67 | 67 |
| 68 // Removes element from the front of the queue and returns |done_task| for | 68 // Removes element from the front of the queue and returns |done_task| for |
| 69 // that element. Called from AdvanceBufferPosition() implementation, which | 69 // that element. Called from AdvanceBufferPosition() implementation, which |
| 70 // then returns result of this function to its caller. | 70 // then returns result of this function to its caller. |
| 71 base::Closure PopQueue(); | 71 base::Closure PopQueue(); |
| 72 | 72 |
| 73 // Following three methods must be implemented in child classes. | 73 // Following three methods must be implemented in child classes. |
| 74 | 74 |
| 75 // Returns next packet that needs to be written to the socket. Implementation | 75 // Returns next packet that needs to be written to the socket. Implementation |
| 76 // must set |*buffer| to NULL if there is nothing left in the queue. | 76 // must set |*buffer| to nullptr if there is nothing left in the queue. |
| 77 virtual void GetNextPacket(net::IOBuffer** buffer, int* size) = 0; | 77 virtual void GetNextPacket(net::IOBuffer** buffer, int* size) = 0; |
| 78 | 78 |
| 79 // Returns closure that must be executed or null closure if the last write | 79 // Returns closure that must be executed or null closure if the last write |
| 80 // didn't complete any messages. | 80 // didn't complete any messages. |
| 81 virtual base::Closure AdvanceBufferPosition(int written) = 0; | 81 virtual base::Closure AdvanceBufferPosition(int written) = 0; |
| 82 | 82 |
| 83 // This method is called whenever there is an error writing to the socket. | 83 // This method is called whenever there is an error writing to the socket. |
| 84 virtual void OnError(int result) = 0; | 84 virtual void OnError(int result) = 0; |
| 85 | 85 |
| 86 private: | 86 private: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 protected: | 123 protected: |
| 124 void GetNextPacket(net::IOBuffer** buffer, int* size) override; | 124 void GetNextPacket(net::IOBuffer** buffer, int* size) override; |
| 125 base::Closure AdvanceBufferPosition(int written) override; | 125 base::Closure AdvanceBufferPosition(int written) override; |
| 126 void OnError(int result) override; | 126 void OnError(int result) override; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace protocol | 129 } // namespace protocol |
| 130 } // namespace remoting | 130 } // namespace remoting |
| 131 | 131 |
| 132 #endif // REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ | 132 #endif // REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ |
| OLD | NEW |