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 |
| 10 #include <memory> |
9 #include <utility> | 11 #include <utility> |
10 | 12 |
11 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "net/base/address_list.h" | 15 #include "net/base/address_list.h" |
15 #include "net/base/load_states.h" | 16 #include "net/base/load_states.h" |
16 #include "net/socket/websocket_endpoint_lock_manager.h" | 17 #include "net/socket/websocket_endpoint_lock_manager.h" |
17 #include "net/socket/websocket_transport_client_socket_pool.h" | 18 #include "net/socket/websocket_transport_client_socket_pool.h" |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 | 21 |
21 class BoundNetLog; | 22 class BoundNetLog; |
22 class ClientSocketFactory; | 23 class ClientSocketFactory; |
23 class IPEndPoint; | 24 class IPEndPoint; |
(...skipping 16 matching lines...) Expand all Loading... |
40 | 41 |
41 // Start connecting. | 42 // Start connecting. |
42 int Start(); | 43 int Start(); |
43 | 44 |
44 bool started() { return next_state_ != STATE_NONE; } | 45 bool started() { return next_state_ != STATE_NONE; } |
45 | 46 |
46 LoadState GetLoadState() const; | 47 LoadState GetLoadState() const; |
47 | 48 |
48 SubJobType type() const { return type_; } | 49 SubJobType type() const { return type_; } |
49 | 50 |
50 scoped_ptr<StreamSocket> PassSocket() { return std::move(transport_socket_); } | 51 std::unique_ptr<StreamSocket> PassSocket() { |
| 52 return std::move(transport_socket_); |
| 53 } |
51 | 54 |
52 // Implementation of WebSocketEndpointLockManager::EndpointWaiter. | 55 // Implementation of WebSocketEndpointLockManager::EndpointWaiter. |
53 void GotEndpointLock() override; | 56 void GotEndpointLock() override; |
54 | 57 |
55 private: | 58 private: |
56 enum State { | 59 enum State { |
57 STATE_NONE, | 60 STATE_NONE, |
58 STATE_OBTAIN_LOCK, | 61 STATE_OBTAIN_LOCK, |
59 STATE_OBTAIN_LOCK_COMPLETE, | 62 STATE_OBTAIN_LOCK_COMPLETE, |
60 STATE_TRANSPORT_CONNECT, | 63 STATE_TRANSPORT_CONNECT, |
(...skipping 15 matching lines...) Expand all Loading... |
76 int DoTransportConnectComplete(int result); | 79 int DoTransportConnectComplete(int result); |
77 | 80 |
78 WebSocketTransportConnectJob* const parent_job_; | 81 WebSocketTransportConnectJob* const parent_job_; |
79 | 82 |
80 const AddressList addresses_; | 83 const AddressList addresses_; |
81 size_t current_address_index_; | 84 size_t current_address_index_; |
82 | 85 |
83 State next_state_; | 86 State next_state_; |
84 const SubJobType type_; | 87 const SubJobType type_; |
85 | 88 |
86 scoped_ptr<StreamSocket> transport_socket_; | 89 std::unique_ptr<StreamSocket> transport_socket_; |
87 | 90 |
88 DISALLOW_COPY_AND_ASSIGN(WebSocketTransportConnectSubJob); | 91 DISALLOW_COPY_AND_ASSIGN(WebSocketTransportConnectSubJob); |
89 }; | 92 }; |
90 | 93 |
91 } // namespace net | 94 } // namespace net |
92 | 95 |
93 #endif // NET_SOCKET_WEBSOCKET_TRANSPORT_CONNECT_SUB_JOB_H_ | 96 #endif // NET_SOCKET_WEBSOCKET_TRANSPORT_CONNECT_SUB_JOB_H_ |
OLD | NEW |