OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // connection is closed is undefined, and may be OS dependent. ERR_IO_PENDING | 41 // connection is closed is undefined, and may be OS dependent. ERR_IO_PENDING |
42 // is returned if the operation could not be completed synchronously, in which | 42 // is returned if the operation could not be completed synchronously, in which |
43 // case the result will be passed to the callback when available. If the | 43 // case the result will be passed to the callback when available. If the |
44 // operation is not completed immediately, the socket acquires a reference to | 44 // operation is not completed immediately, the socket acquires a reference to |
45 // the provided buffer until the callback is invoked or the socket is | 45 // the provided buffer until the callback is invoked or the socket is |
46 // closed. Implementations of this method should not modify the contents | 46 // closed. Implementations of this method should not modify the contents |
47 // of the actual buffer that is written to the socket. If the socket is | 47 // of the actual buffer that is written to the socket. If the socket is |
48 // Disconnected before the write completes, the callback will not be invoked. | 48 // Disconnected before the write completes, the callback will not be invoked. |
49 virtual int Write(IOBuffer* buf, int buf_len, | 49 virtual int Write(IOBuffer* buf, int buf_len, |
50 OldCompletionCallback* callback) = 0; | 50 OldCompletionCallback* callback) = 0; |
| 51 virtual int Write(IOBuffer* buf, int buf_len, |
| 52 const CompletionCallback& callback) = 0; |
51 | 53 |
52 // Set the receive buffer size (in bytes) for the socket. | 54 // Set the receive buffer size (in bytes) for the socket. |
53 // Note: changing this value can affect the TCP window size on some platforms. | 55 // Note: changing this value can affect the TCP window size on some platforms. |
54 // Returns true on success, or false on failure. | 56 // Returns true on success, or false on failure. |
55 virtual bool SetReceiveBufferSize(int32 size) = 0; | 57 virtual bool SetReceiveBufferSize(int32 size) = 0; |
56 | 58 |
57 // Set the send buffer size (in bytes) for the socket. | 59 // Set the send buffer size (in bytes) for the socket. |
58 // Note: changing this value can affect the TCP window size on some platforms. | 60 // Note: changing this value can affect the TCP window size on some platforms. |
59 // Returns true on success, or false on failure. | 61 // Returns true on success, or false on failure. |
60 virtual bool SetSendBufferSize(int32 size) = 0; | 62 virtual bool SetSendBufferSize(int32 size) = 0; |
61 }; | 63 }; |
62 | 64 |
63 } // namespace net | 65 } // namespace net |
64 | 66 |
65 #endif // NET_SOCKET_SOCKET_H_ | 67 #endif // NET_SOCKET_SOCKET_H_ |
OLD | NEW |