summaryrefslogtreecommitdiffstats
path: root/net/base/socket.h
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-30 21:51:25 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-30 21:51:25 +0000
commitffeb088e92325536ac1c371df3c4bd857ccb1221 (patch)
treeaf34055a796ac8181e3d90b838a02fcaf960ce26 /net/base/socket.h
parentb57d5cc9dd98fc4fb284878ecc73e2eb95f6d1bd (diff)
downloadchromium_src-ffeb088e92325536ac1c371df3c4bd857ccb1221.zip
chromium_src-ffeb088e92325536ac1c371df3c4bd857ccb1221.tar.gz
chromium_src-ffeb088e92325536ac1c371df3c4bd857ccb1221.tar.bz2
Extend the use of IOBuffers to the code underneath
HttpNetworkTransaction (to the Socket class). This is the first step to remove the blocking call on the destructor of the network transaction, from IO thread. BUG=9258 R=wtc Review URL: http://codereview.chromium.org/87073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14998 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/socket.h')
-rw-r--r--net/base/socket.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/net/base/socket.h b/net/base/socket.h
index c8db6d1..843104b 100644
--- a/net/base/socket.h
+++ b/net/base/socket.h
@@ -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 @@ class Socket {
// 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;
};