Index: remoting/protocol/buffered_socket_writer.h |
diff --git a/remoting/protocol/buffered_socket_writer.h b/remoting/protocol/buffered_socket_writer.h |
index d840270e5a625ffd79d6e74cdeec444dc90deff9..2a92b05493d67419b4f05bc0e4b64107049a3267 100644 |
--- a/remoting/protocol/buffered_socket_writer.h |
+++ b/remoting/protocol/buffered_socket_writer.h |
@@ -67,19 +67,24 @@ class BufferedSocketWriterBase : public base::NonThreadSafe { |
// Removes element from the front of the queue and calls |done_task| |
// for that element. |
- void PopQueue(); |
+ base::Closure PopQueue(); |
simonmorris
2012/07/31 20:19:50
Maybe document what the caller may/should/must do
Sergey Ulanov
2012/07/31 21:37:53
Done.
|
// Following three methods must be implemented in child classes. |
- // GetNextPacket() returns next packet that needs to be written to the |
- // socket. |buffer| must be set to NULL if there is nothing left in the queue. |
+ |
+ // Returns next packet that needs to be written to the socket. |buffer| must |
simonmorris
2012/07/31 20:19:50
"|buffer| must" -> "*buffer will"? "Must" sounds l
Sergey Ulanov
2012/07/31 21:37:53
Done.
|
+ // be set to NULL if there is nothing left in the queue. |
virtual void GetNextPacket(net::IOBuffer** buffer, int* size) = 0; |
- virtual void AdvanceBufferPosition(int written) = 0; |
+ |
+ // Returns closure that must be executed or null closure if the last write |
+ // didn't complete any messages. |
+ virtual base::Closure AdvanceBufferPosition(int written) = 0; |
// This method is called whenever there is an error writing to the socket. |
virtual void OnError(int result) = 0; |
private: |
void DoWrite(); |
+ void HandleWriteResult(int result, bool* write_again); |
void OnWritten(int result); |
// This method is called when an error is encountered. |
@@ -91,6 +96,8 @@ class BufferedSocketWriterBase : public base::NonThreadSafe { |
bool write_pending_; |
bool closed_; |
+ |
+ bool* destroyed_flag_; |
}; |
class BufferedSocketWriter : public BufferedSocketWriterBase { |
@@ -100,7 +107,7 @@ class BufferedSocketWriter : public BufferedSocketWriterBase { |
protected: |
virtual void GetNextPacket(net::IOBuffer** buffer, int* size) OVERRIDE; |
- virtual void AdvanceBufferPosition(int written) OVERRIDE; |
+ virtual base::Closure AdvanceBufferPosition(int written) OVERRIDE; |
virtual void OnError(int result) OVERRIDE; |
private: |
@@ -114,7 +121,7 @@ class BufferedDatagramWriter : public BufferedSocketWriterBase { |
protected: |
virtual void GetNextPacket(net::IOBuffer** buffer, int* size) OVERRIDE; |
- virtual void AdvanceBufferPosition(int written) OVERRIDE; |
+ virtual base::Closure AdvanceBufferPosition(int written) OVERRIDE; |
virtual void OnError(int result) OVERRIDE; |
}; |