| Index: net/base/socket.h
|
| ===================================================================
|
| --- net/base/socket.h (revision 14682)
|
| +++ net/base/socket.h (working copy)
|
| @@ -6,6 +6,7 @@
|
| #define NET_BASE_SOCKET_H_
|
|
|
| #include "net/base/completion_callback.h"
|
| +#include "net/base/io_buffer.h"
|
|
|
| namespace net {
|
|
|
| @@ -18,16 +19,22 @@
|
| // read is returned, or an error is returned upon failure. Zero is returned
|
| // to indicate end-of-file. ERR_IO_PENDING is returned if the operation
|
| // could not be completed synchronously, in which case the result will be
|
| - // passed to the callback when available.
|
| - virtual int Read(char* buf, int buf_len,
|
| + // passed to the callback when available. If the operation is not completed
|
| + // immediately, the socket acquires a reference to the provided buffer until
|
| + // the callback is invoked or the socket is destroyed.
|
| + virtual int Read(IOBuffer* buf, int buf_len,
|
| CompletionCallback* callback) = 0;
|
|
|
| // Writes data, up to buf_len bytes, to the socket. Note: only part of the
|
| // data may be written! The number of bytes written is returned, or an error
|
| // is returned upon failure. ERR_IO_PENDING is returned if the operation
|
| // could not be completed synchronously, in which case the result will be
|
| - // passed to the callback when available.
|
| - virtual int Write(const char* buf, int buf_len,
|
| + // passed to the callback when available. If the operation is not completed
|
| + // immediately, the socket acquires a reference to the provided buffer until
|
| + // the callback is invoked or the socket is destroyed.
|
| + // Implementations of this method should not modify the contents of the actual
|
| + // buffer that is written to the socket.
|
| + virtual int Write(IOBuffer* buf, int buf_len,
|
| CompletionCallback* callback) = 0;
|
| };
|
|
|
|
|