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

Side by Side Diff: net/udp/udp_socket_win.h

Issue 8801005: base::Bind: Convert Socket::Read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years 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
« no previous file with comments | « net/udp/udp_socket_libevent.cc ('k') | net/udp/udp_socket_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_UDP_UDP_SOCKET_WIN_H_ 5 #ifndef NET_UDP_UDP_SOCKET_WIN_H_
6 #define NET_UDP_UDP_SOCKET_WIN_H_ 6 #define NET_UDP_UDP_SOCKET_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include <winsock2.h> 9 #include <winsock2.h>
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 int GetLocalAddress(IPEndPoint* address) const; 49 int GetLocalAddress(IPEndPoint* address) const;
50 50
51 // IO: 51 // IO:
52 // Multiple outstanding read requests are not supported. 52 // Multiple outstanding read requests are not supported.
53 // Full duplex mode (reading and writing at the same time) is supported 53 // Full duplex mode (reading and writing at the same time) is supported
54 54
55 // Read from the socket. 55 // Read from the socket.
56 // Only usable from the client-side of a UDP socket, after the socket 56 // Only usable from the client-side of a UDP socket, after the socket
57 // has been connected. 57 // has been connected.
58 int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); 58 int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback);
59 int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback);
59 60
60 // Write to the socket. 61 // Write to the socket.
61 // Only usable from the client-side of a UDP socket, after the socket 62 // Only usable from the client-side of a UDP socket, after the socket
62 // has been connected. 63 // has been connected.
63 int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); 64 int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback);
64 65
65 // Read from a socket and receive sender address information. 66 // Read from a socket and receive sender address information.
66 // |buf| is the buffer to read data into. 67 // |buf| is the buffer to read data into.
67 // |buf_len| is the maximum amount of data to read. 68 // |buf_len| is the maximum amount of data to read.
68 // |address| is a buffer provided by the caller for receiving the sender 69 // |address| is a buffer provided by the caller for receiving the sender
69 // address information about the received data. This buffer must be kept 70 // address information about the received data. This buffer must be kept
70 // alive by the caller until the callback is placed. 71 // alive by the caller until the callback is placed.
71 // |address_length| is a ptr to the length of the |address| buffer. This 72 // |address_length| is a ptr to the length of the |address| buffer. This
72 // is an input parameter containing the maximum size |address| can hold 73 // is an input parameter containing the maximum size |address| can hold
73 // and also an output parameter for the size of |address| upon completion. 74 // and also an output parameter for the size of |address| upon completion.
74 // |callback| the callback on completion of the Recv. 75 // |callback| the callback on completion of the Recv.
75 // Returns a net error code, or ERR_IO_PENDING if the IO is in progress. 76 // Returns a net error code, or ERR_IO_PENDING if the IO is in progress.
76 // If ERR_IO_PENDING is returned, the caller must keep |buf|, |address|, 77 // If ERR_IO_PENDING is returned, the caller must keep |buf|, |address|,
77 // and |address_length| alive until the callback is called. 78 // and |address_length| alive until the callback is called.
78 int RecvFrom(IOBuffer* buf, 79 int RecvFrom(IOBuffer* buf,
79 int buf_len, 80 int buf_len,
80 IPEndPoint* address, 81 IPEndPoint* address,
81 OldCompletionCallback* callback); 82 OldCompletionCallback* callback);
83 int RecvFrom(IOBuffer* buf,
84 int buf_len,
85 IPEndPoint* address,
86 const CompletionCallback& callback);
82 87
83 // Send to a socket with a particular destination. 88 // Send to a socket with a particular destination.
84 // |buf| is the buffer to send 89 // |buf| is the buffer to send
85 // |buf_len| is the number of bytes to send 90 // |buf_len| is the number of bytes to send
86 // |address| is the recipient address. 91 // |address| is the recipient address.
87 // |address_length| is the size of the recipient address 92 // |address_length| is the size of the recipient address
88 // |callback| is the user callback function to call on complete. 93 // |callback| is the user callback function to call on complete.
89 // Returns a net error code, or ERR_IO_PENDING if the IO is in progress. 94 // Returns a net error code, or ERR_IO_PENDING if the IO is in progress.
90 // If ERR_IO_PENDING is returned, the caller must keep |buf| and |address| 95 // If ERR_IO_PENDING is returned, the caller must keep |buf| and |address|
91 // alive until the callback is called. 96 // alive until the callback is called.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 IPEndPoint* recv_from_address_; 201 IPEndPoint* recv_from_address_;
197 202
198 // Cached copy of the current address we're sending to, if any. Used for 203 // Cached copy of the current address we're sending to, if any. Used for
199 // logging. 204 // logging.
200 scoped_ptr<IPEndPoint> send_to_address_; 205 scoped_ptr<IPEndPoint> send_to_address_;
201 206
202 // The buffer used by InternalWrite() to retry Write requests 207 // The buffer used by InternalWrite() to retry Write requests
203 scoped_refptr<IOBuffer> write_iobuffer_; 208 scoped_refptr<IOBuffer> write_iobuffer_;
204 209
205 // External callback; called when read is complete. 210 // External callback; called when read is complete.
206 OldCompletionCallback* read_callback_; 211 OldCompletionCallback* old_read_callback_;
212 CompletionCallback read_callback_;
207 213
208 // External callback; called when write is complete. 214 // External callback; called when write is complete.
209 OldCompletionCallback* write_callback_; 215 OldCompletionCallback* write_callback_;
210 216
211 BoundNetLog net_log_; 217 BoundNetLog net_log_;
212 218
213 DISALLOW_COPY_AND_ASSIGN(UDPSocketWin); 219 DISALLOW_COPY_AND_ASSIGN(UDPSocketWin);
214 }; 220 };
215 221
216 } // namespace net 222 } // namespace net
217 223
218 #endif // NET_UDP_UDP_SOCKET_WIN_H_ 224 #endif // NET_UDP_UDP_SOCKET_WIN_H_
OLDNEW
« no previous file with comments | « net/udp/udp_socket_libevent.cc ('k') | net/udp/udp_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698