Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: net/socket/socket.h

Issue 3417010: Integrate the SpdyProxyClientSocket into the HttpStreamRequest... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebasing again Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 NET_SOCKET_SOCKET_H_ 5 #ifndef NET_SOCKET_SOCKET_H_
6 #define NET_SOCKET_SOCKET_H_ 6 #define NET_SOCKET_SOCKET_H_
7 #pragma once 7 #pragma once
8 8
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 class IOBuffer; 13 class IOBuffer;
14 14
15 // Represents a read/write socket. 15 // Represents a read/write socket.
16 class Socket { 16 class Socket {
17 public: 17 public:
18 virtual ~Socket() {} 18 virtual ~Socket() {}
19 19
20 // Reads data, up to buf_len bytes, from the socket. The number of bytes read 20 // Reads data, up to buf_len bytes, from the socket. The number of bytes read
21 // is returned, or an error is returned upon failure. 21 // is returned, or an error is returned upon failure.
22 // ERR_SOCKET_NOT_CONNECTED should be returned if the socket is not currently 22 // ERR_SOCKET_NOT_CONNECTED should be returned if the socket is not currently
23 // connected. Zero is returned once to indicate end-of-file; the return value 23 // connected. Zero is returned once to indicate end-of-file; the return value
24 // of subsequent calls is undefined, and may be OS dependent. ERR_IO_PENDING 24 // of subsequent calls is undefined, and may be OS dependent. ERR_IO_PENDING
25 // is returned if the operation could not be completed synchronously, in which 25 // is returned if the operation could not be completed synchronously, in which
26 // case the result will be passed to the callback when available. If the 26 // case the result will be passed to the callback when available. If the
27 // operation is not completed immediately, the socket acquires a reference to 27 // operation is not completed immediately, the socket acquires a reference to
28 // the provided buffer until the callback is invoked or the socket is 28 // the provided buffer until the callback is invoked or the socket is
29 // destroyed. If the socket is closed before the read completes, the callback 29 // closed. If the socket is Disconnected before the read completes, the
30 // will not be invoked. 30 // callback will not be invoked.
31 virtual int Read(IOBuffer* buf, int buf_len, 31 virtual int Read(IOBuffer* buf, int buf_len,
32 CompletionCallback* callback) = 0; 32 CompletionCallback* callback) = 0;
33 33
34 // Writes data, up to buf_len bytes, to the socket. Note: only part of the 34 // Writes data, up to buf_len bytes, to the socket. Note: only part of the
35 // data may be written! The number of bytes written is returned, or an error 35 // data may be written! The number of bytes written is returned, or an error
36 // is returned upon failure. ERR_SOCKET_NOT_CONNECTED should be returned if 36 // is returned upon failure. ERR_SOCKET_NOT_CONNECTED should be returned if
37 // the socket is not currently connected. The return value when the 37 // the socket is not currently connected. The return value when the
38 // connection is closed is undefined, and may be OS dependent. ERR_IO_PENDING 38 // connection is closed is undefined, and may be OS dependent. ERR_IO_PENDING
39 // is returned if the operation could not be completed synchronously, in which 39 // is returned if the operation could not be completed synchronously, in which
40 // case the result will be passed to the callback when available. If the 40 // case the result will be passed to the callback when available. If the
41 // operation is not completed immediately, the socket acquires a reference to 41 // operation is not completed immediately, the socket acquires a reference to
42 // the provided buffer until the callback is invoked or the socket is 42 // the provided buffer until the callback is invoked or the socket is
43 // destroyed. Implementations of this method should not modify the contents 43 // closed. Implementations of this method should not modify the contents
44 // of the actual buffer that is written to the socket. If the socket is 44 // of the actual buffer that is written to the socket. If the socket is
45 // closed before the write completes, the callback will not be invoked. 45 // Disconnected before the write completes, the callback will not be invoked.
46 virtual int Write(IOBuffer* buf, int buf_len, 46 virtual int Write(IOBuffer* buf, int buf_len,
47 CompletionCallback* callback) = 0; 47 CompletionCallback* callback) = 0;
48 48
49 // Set the receive buffer size (in bytes) for the socket. 49 // Set the receive buffer size (in bytes) for the socket.
50 // Note: changing this value can effect the TCP window size on some platforms. 50 // Note: changing this value can effect the TCP window size on some platforms.
51 // Returns true on success, or false on failure. 51 // Returns true on success, or false on failure.
52 virtual bool SetReceiveBufferSize(int32 size) = 0; 52 virtual bool SetReceiveBufferSize(int32 size) = 0;
53 53
54 // Set the send buffer size (in bytes) for the socket. 54 // Set the send buffer size (in bytes) for the socket.
55 // Note: changing this value can effect the TCP window size on some platforms. 55 // Note: changing this value can effect the TCP window size on some platforms.
56 // Returns true on success, or false on failure. 56 // Returns true on success, or false on failure.
57 virtual bool SetSendBufferSize(int32 size) = 0; 57 virtual bool SetSendBufferSize(int32 size) = 0;
58 }; 58 };
59 59
60 } // namespace net 60 } // namespace net
61 61
62 #endif // NET_SOCKET_SOCKET_H_ 62 #endif // NET_SOCKET_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698