OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/socket/ssl_client_socket_pool.h" | 5 #include "net/socket/ssl_client_socket_pool.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
13 #include "base/metrics/sparse_histogram.h" | 13 #include "base/metrics/sparse_histogram.h" |
14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "net/http/http_proxy_client_socket.h" | 18 #include "net/http/http_proxy_client_socket.h" |
19 #include "net/http/http_proxy_client_socket_pool.h" | 19 #include "net/http/http_proxy_client_socket_pool.h" |
20 #include "net/socket/client_socket_factory.h" | 20 #include "net/socket/client_socket_factory.h" |
21 #include "net/socket/client_socket_handle.h" | 21 #include "net/socket/client_socket_handle.h" |
22 #include "net/socket/socks_client_socket_pool.h" | 22 #include "net/socket/socks_client_socket_pool.h" |
23 #include "net/socket/ssl_client_socket.h" | 23 #include "net/socket/ssl_client_socket.h" |
24 #include "net/socket/transport_client_socket_pool.h" | 24 #include "net/socket/transport_client_socket_pool.h" |
25 #include "net/ssl/ssl_cert_request_info.h" | 25 #include "net/ssl/ssl_cert_request_info.h" |
26 #include "net/ssl/ssl_cipher_suite_names.h" | 26 #include "net/ssl/ssl_cipher_suite_names.h" |
27 #include "net/ssl/ssl_connection_status_flags.h" | 27 #include "net/ssl/ssl_connection_status_flags.h" |
28 #include "net/ssl/ssl_info.h" | 28 #include "net/ssl/ssl_info.h" |
29 | 29 |
| 30 #include "base/trace_event/trace_event.h" |
| 31 |
30 namespace net { | 32 namespace net { |
31 | 33 |
32 SSLSocketParams::SSLSocketParams( | 34 SSLSocketParams::SSLSocketParams( |
33 const scoped_refptr<TransportSocketParams>& direct_params, | 35 const scoped_refptr<TransportSocketParams>& direct_params, |
34 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params, | 36 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params, |
35 const scoped_refptr<HttpProxySocketParams>& http_proxy_params, | 37 const scoped_refptr<HttpProxySocketParams>& http_proxy_params, |
36 const HostPortPair& host_and_port, | 38 const HostPortPair& host_and_port, |
37 const SSLConfig& ssl_config, | 39 const SSLConfig& ssl_config, |
38 PrivacyMode privacy_mode, | 40 PrivacyMode privacy_mode, |
39 int load_flags, | 41 int load_flags, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 handle->set_ssl_error_response_info(error_response_info_); | 161 handle->set_ssl_error_response_info(error_response_info_); |
160 if (!connect_timing_.ssl_start.is_null()) | 162 if (!connect_timing_.ssl_start.is_null()) |
161 handle->set_is_ssl_error(true); | 163 handle->set_is_ssl_error(true); |
162 if (ssl_socket_) | 164 if (ssl_socket_) |
163 handle->set_ssl_failure_state(ssl_socket_->GetSSLFailureState()); | 165 handle->set_ssl_failure_state(ssl_socket_->GetSSLFailureState()); |
164 | 166 |
165 handle->set_connection_attempts(connection_attempts_); | 167 handle->set_connection_attempts(connection_attempts_); |
166 } | 168 } |
167 | 169 |
168 void SSLConnectJob::OnIOComplete(int result) { | 170 void SSLConnectJob::OnIOComplete(int result) { |
| 171 TRACE_EVENT0("net", "net::SSLConnectJob::OnIOComplete"); |
169 int rv = DoLoop(result); | 172 int rv = DoLoop(result); |
170 if (rv != ERR_IO_PENDING) | 173 if (rv != ERR_IO_PENDING) |
171 NotifyDelegateOfCompletion(rv); // Deletes |this|. | 174 NotifyDelegateOfCompletion(rv); // Deletes |this|. |
172 } | 175 } |
173 | 176 |
174 int SSLConnectJob::DoLoop(int result) { | 177 int SSLConnectJob::DoLoop(int result) { |
| 178 TRACE_EVENT0("net", "net::SSLConnectJob::DoLoop"); |
175 DCHECK_NE(next_state_, STATE_NONE); | 179 DCHECK_NE(next_state_, STATE_NONE); |
176 | 180 |
177 int rv = result; | 181 int rv = result; |
178 do { | 182 do { |
179 State state = next_state_; | 183 State state = next_state_; |
180 next_state_ = STATE_NONE; | 184 next_state_ = STATE_NONE; |
181 switch (state) { | 185 switch (state) { |
182 case STATE_TRANSPORT_CONNECT: | 186 case STATE_TRANSPORT_CONNECT: |
183 DCHECK_EQ(OK, rv); | 187 DCHECK_EQ(OK, rv); |
184 rv = DoTransportConnect(); | 188 rv = DoTransportConnect(); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 if (base_.CloseOneIdleSocket()) | 673 if (base_.CloseOneIdleSocket()) |
670 return true; | 674 return true; |
671 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 675 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
672 } | 676 } |
673 | 677 |
674 void SSLClientSocketPool::OnSSLConfigChanged() { | 678 void SSLClientSocketPool::OnSSLConfigChanged() { |
675 FlushWithError(ERR_NETWORK_CHANGED); | 679 FlushWithError(ERR_NETWORK_CHANGED); |
676 } | 680 } |
677 | 681 |
678 } // namespace net | 682 } // namespace net |
OLD | NEW |