Index: remoting/base/buffered_socket_writer.h |
diff --git a/remoting/base/buffered_socket_writer.h b/remoting/base/buffered_socket_writer.h |
index c6012e37e8bc97efe98cc09ba43a876c01596a24..2c530b3f38659f990c2241b152df7c8677405082 100644 |
--- a/remoting/base/buffered_socket_writer.h |
+++ b/remoting/base/buffered_socket_writer.h |
@@ -10,12 +10,8 @@ |
#include "base/callback.h" |
#include "base/synchronization/lock.h" |
#include "base/threading/non_thread_safe.h" |
+#include "net/base/completion_callback.h" |
#include "net/base/io_buffer.h" |
-#include "net/socket/socket.h" |
- |
-namespace net { |
-class Socket; |
-} // namespace net |
namespace remoting { |
@@ -27,9 +23,11 @@ namespace remoting { |
// Whenever new data is written it is just put in the queue, and then written |
// on the thread that owns the socket. GetBufferChunks() and GetBufferSize() |
// can be used to throttle writes. |
- |
class BufferedSocketWriterBase : public base::NonThreadSafe { |
public: |
+ typedef base::Callback<int(net::IOBuffer* buf, int buf_len, |
+ const net::CompletionCallback& callback)> |
+ WriteCallback; |
typedef base::Callback<void(int)> WriteFailedCallback; |
BufferedSocketWriterBase(); |
@@ -37,9 +35,9 @@ class BufferedSocketWriterBase : public base::NonThreadSafe { |
// Initializes the writer. Must be called on the thread that will be used |
// to access the socket in the future. |callback| will be called after each |
- // failed write. Caller retains ownership of |socket|. |
- // TODO(sergeyu): Change it so that it take ownership of |socket|. |
- void Init(net::Socket* socket, const WriteFailedCallback& callback); |
+ // failed write. |
+ void Init(const WriteCallback& write_callback, |
+ const WriteFailedCallback& write_failed_callback); |
// Puts a new data chunk in the buffer. Returns false and doesn't enqueue |
// the data if called before Init(). Can be called on any thread. |
@@ -85,7 +83,7 @@ class BufferedSocketWriterBase : public base::NonThreadSafe { |
// This method is called when an error is encountered. |
void HandleError(int result); |
- net::Socket* socket_; |
+ WriteCallback write_callback_; |
WriteFailedCallback write_failed_callback_; |
bool write_pending_; |