OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CLIENT_SOCKET_HANDLE_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 // A container for a ClientSocket. | 26 // A container for a ClientSocket. |
27 // | 27 // |
28 // The handle's |group_name| uniquely identifies the origin and type of the | 28 // The handle's |group_name| uniquely identifies the origin and type of the |
29 // connection. It is used by the ClientSocketPool to group similar connected | 29 // connection. It is used by the ClientSocketPool to group similar connected |
30 // client socket objects. | 30 // client socket objects. |
31 // | 31 // |
32 class ClientSocketHandle { | 32 class ClientSocketHandle { |
33 public: | 33 public: |
34 typedef enum { | 34 enum SocketReuseType { |
35 UNUSED = 0, // unused socket that just finished connecting | 35 UNUSED = 0, // unused socket that just finished connecting |
36 UNUSED_IDLE, // unused socket that has been idle for awhile | 36 UNUSED_IDLE, // unused socket that has been idle for awhile |
37 REUSED_IDLE, // previously used socket | 37 REUSED_IDLE, // previously used socket |
38 NUM_TYPES, | 38 NUM_TYPES, |
39 } SocketReuseType; | 39 }; |
40 | 40 |
41 ClientSocketHandle(); | 41 ClientSocketHandle(); |
42 ~ClientSocketHandle(); | 42 ~ClientSocketHandle(); |
43 | 43 |
44 // Initializes a ClientSocketHandle object, which involves talking to the | 44 // Initializes a ClientSocketHandle object, which involves talking to the |
45 // ClientSocketPool to obtain a connected socket, possibly reusing one. This | 45 // ClientSocketPool to obtain a connected socket, possibly reusing one. This |
46 // method returns either OK or ERR_IO_PENDING. On ERR_IO_PENDING, |priority| | 46 // method returns either OK or ERR_IO_PENDING. On ERR_IO_PENDING, |priority| |
47 // is used to determine the placement in ClientSocketPool's wait list. | 47 // is used to determine the placement in ClientSocketPool's wait list. |
48 // | 48 // |
49 // If this method succeeds, then the socket member will be set to an existing | 49 // If this method succeeds, then the socket member will be set to an existing |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 user_callback_ = callback; | 207 user_callback_ = callback; |
208 } else { | 208 } else { |
209 HandleInitCompletion(rv); | 209 HandleInitCompletion(rv); |
210 } | 210 } |
211 return rv; | 211 return rv; |
212 } | 212 } |
213 | 213 |
214 } // namespace net | 214 } // namespace net |
215 | 215 |
216 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 216 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
OLD | NEW |