| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WEBSOCKET_TRANSPORT_CONNECT_SUB_JOB_H_ | 5 #ifndef NET_SOCKET_WEBSOCKET_TRANSPORT_CONNECT_SUB_JOB_H_ |
| 6 #define NET_SOCKET_WEBSOCKET_TRANSPORT_CONNECT_SUB_JOB_H_ | 6 #define NET_SOCKET_WEBSOCKET_TRANSPORT_CONNECT_SUB_JOB_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "net/base/address_list.h" | 15 #include "net/base/address_list.h" |
| 16 #include "net/base/load_states.h" | 16 #include "net/base/load_states.h" |
| 17 #include "net/socket/websocket_endpoint_lock_manager.h" | 17 #include "net/socket/websocket_endpoint_lock_manager.h" |
| 18 #include "net/socket/websocket_transport_client_socket_pool.h" | 18 #include "net/socket/websocket_transport_client_socket_pool.h" |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 | 21 |
| 22 class BoundNetLog; | 22 class NetLogWithSource; |
| 23 class ClientSocketFactory; | 23 class ClientSocketFactory; |
| 24 class IPEndPoint; | 24 class IPEndPoint; |
| 25 class StreamSocket; | 25 class StreamSocket; |
| 26 | 26 |
| 27 // Attempts to connect to a subset of the addresses required by a | 27 // Attempts to connect to a subset of the addresses required by a |
| 28 // WebSocketTransportConnectJob, specifically either the IPv4 or IPv6 | 28 // WebSocketTransportConnectJob, specifically either the IPv4 or IPv6 |
| 29 // addresses. Each address is tried in turn, and parent_job->OnSubJobComplete() | 29 // addresses. Each address is tried in turn, and parent_job->OnSubJobComplete() |
| 30 // is called when the first address succeeds or the last address fails. | 30 // is called when the first address succeeds or the last address fails. |
| 31 class WebSocketTransportConnectSubJob | 31 class WebSocketTransportConnectSubJob |
| 32 : public WebSocketEndpointLockManager::Waiter { | 32 : public WebSocketEndpointLockManager::Waiter { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 60 STATE_NONE, | 60 STATE_NONE, |
| 61 STATE_OBTAIN_LOCK, | 61 STATE_OBTAIN_LOCK, |
| 62 STATE_OBTAIN_LOCK_COMPLETE, | 62 STATE_OBTAIN_LOCK_COMPLETE, |
| 63 STATE_TRANSPORT_CONNECT, | 63 STATE_TRANSPORT_CONNECT, |
| 64 STATE_TRANSPORT_CONNECT_COMPLETE, | 64 STATE_TRANSPORT_CONNECT_COMPLETE, |
| 65 STATE_DONE, | 65 STATE_DONE, |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 ClientSocketFactory* client_socket_factory() const; | 68 ClientSocketFactory* client_socket_factory() const; |
| 69 | 69 |
| 70 const BoundNetLog& net_log() const; | 70 const NetLogWithSource& net_log() const; |
| 71 | 71 |
| 72 const IPEndPoint& CurrentAddress() const; | 72 const IPEndPoint& CurrentAddress() const; |
| 73 | 73 |
| 74 void OnIOComplete(int result); | 74 void OnIOComplete(int result); |
| 75 int DoLoop(int result); | 75 int DoLoop(int result); |
| 76 int DoEndpointLock(); | 76 int DoEndpointLock(); |
| 77 int DoEndpointLockComplete(); | 77 int DoEndpointLockComplete(); |
| 78 int DoTransportConnect(); | 78 int DoTransportConnect(); |
| 79 int DoTransportConnectComplete(int result); | 79 int DoTransportConnectComplete(int result); |
| 80 | 80 |
| 81 WebSocketTransportConnectJob* const parent_job_; | 81 WebSocketTransportConnectJob* const parent_job_; |
| 82 | 82 |
| 83 const AddressList addresses_; | 83 const AddressList addresses_; |
| 84 size_t current_address_index_; | 84 size_t current_address_index_; |
| 85 | 85 |
| 86 State next_state_; | 86 State next_state_; |
| 87 const SubJobType type_; | 87 const SubJobType type_; |
| 88 | 88 |
| 89 std::unique_ptr<StreamSocket> transport_socket_; | 89 std::unique_ptr<StreamSocket> transport_socket_; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(WebSocketTransportConnectSubJob); | 91 DISALLOW_COPY_AND_ASSIGN(WebSocketTransportConnectSubJob); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace net | 94 } // namespace net |
| 95 | 95 |
| 96 #endif // NET_SOCKET_WEBSOCKET_TRANSPORT_CONNECT_SUB_JOB_H_ | 96 #endif // NET_SOCKET_WEBSOCKET_TRANSPORT_CONNECT_SUB_JOB_H_ |
| OLD | NEW |