OLD | NEW |
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_CLIENT_SOCKET_POOL_BASE_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
6 #define NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ConnectJob(const std::string& group_name, | 45 ConnectJob(const std::string& group_name, |
46 const ClientSocketHandle* key_handle, | 46 const ClientSocketHandle* key_handle, |
47 Delegate* delegate); | 47 Delegate* delegate); |
48 virtual ~ConnectJob(); | 48 virtual ~ConnectJob(); |
49 | 49 |
50 // Accessors | 50 // Accessors |
51 const std::string& group_name() const { return group_name_; } | 51 const std::string& group_name() const { return group_name_; } |
52 LoadState load_state() const { return load_state_; } | 52 LoadState load_state() const { return load_state_; } |
53 const ClientSocketHandle* key_handle() const { return key_handle_; } | 53 const ClientSocketHandle* key_handle() const { return key_handle_; } |
54 | 54 |
55 // Releases |socket_| to the client. | 55 // Releases |socket_| to the client. On connection error, this should return |
| 56 // NULL. |
56 ClientSocket* ReleaseSocket() { return socket_.release(); } | 57 ClientSocket* ReleaseSocket() { return socket_.release(); } |
57 | 58 |
58 // Begins connecting the socket. Returns OK on success, ERR_IO_PENDING if it | 59 // Begins connecting the socket. Returns OK on success, ERR_IO_PENDING if it |
59 // cannot complete synchronously without blocking, or another net error code | 60 // cannot complete synchronously without blocking, or another net error code |
60 // on error. In asynchronous completion, the ConnectJob will notify | 61 // on error. In asynchronous completion, the ConnectJob will notify |
61 // |delegate_| via OnConnectJobComplete. In both asynchronous and synchronous | 62 // |delegate_| via OnConnectJobComplete. In both asynchronous and synchronous |
62 // completion, ReleaseSocket() can be called to acquire the connected socket | 63 // completion, ReleaseSocket() can be called to acquire the connected socket |
63 // if it succeeded. | 64 // if it succeeded. |
64 virtual int Connect() = 0; | 65 virtual int Connect() = 0; |
65 | 66 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 const int max_sockets_per_group_; | 252 const int max_sockets_per_group_; |
252 | 253 |
253 const scoped_ptr<ConnectJobFactory> connect_job_factory_; | 254 const scoped_ptr<ConnectJobFactory> connect_job_factory_; |
254 | 255 |
255 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 256 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
256 }; | 257 }; |
257 | 258 |
258 } // namespace net | 259 } // namespace net |
259 | 260 |
260 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 261 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
OLD | NEW |