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/trace_event/trace_event.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
18 #include "net/http/http_proxy_client_socket.h" | 19 #include "net/http/http_proxy_client_socket.h" |
19 #include "net/http/http_proxy_client_socket_pool.h" | 20 #include "net/http/http_proxy_client_socket_pool.h" |
20 #include "net/socket/client_socket_factory.h" | 21 #include "net/socket/client_socket_factory.h" |
21 #include "net/socket/client_socket_handle.h" | 22 #include "net/socket/client_socket_handle.h" |
22 #include "net/socket/socks_client_socket_pool.h" | 23 #include "net/socket/socks_client_socket_pool.h" |
23 #include "net/socket/ssl_client_socket.h" | 24 #include "net/socket/ssl_client_socket.h" |
24 #include "net/socket/transport_client_socket_pool.h" | 25 #include "net/socket/transport_client_socket_pool.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 handle->set_ssl_error_response_info(error_response_info_); | 160 handle->set_ssl_error_response_info(error_response_info_); |
160 if (!connect_timing_.ssl_start.is_null()) | 161 if (!connect_timing_.ssl_start.is_null()) |
161 handle->set_is_ssl_error(true); | 162 handle->set_is_ssl_error(true); |
162 if (ssl_socket_) | 163 if (ssl_socket_) |
163 handle->set_ssl_failure_state(ssl_socket_->GetSSLFailureState()); | 164 handle->set_ssl_failure_state(ssl_socket_->GetSSLFailureState()); |
164 | 165 |
165 handle->set_connection_attempts(connection_attempts_); | 166 handle->set_connection_attempts(connection_attempts_); |
166 } | 167 } |
167 | 168 |
168 void SSLConnectJob::OnIOComplete(int result) { | 169 void SSLConnectJob::OnIOComplete(int result) { |
| 170 TRACE_EVENT0("net", "SSLConnectJob::OnIOComplete"); |
169 int rv = DoLoop(result); | 171 int rv = DoLoop(result); |
170 if (rv != ERR_IO_PENDING) | 172 if (rv != ERR_IO_PENDING) |
171 NotifyDelegateOfCompletion(rv); // Deletes |this|. | 173 NotifyDelegateOfCompletion(rv); // Deletes |this|. |
172 } | 174 } |
173 | 175 |
174 int SSLConnectJob::DoLoop(int result) { | 176 int SSLConnectJob::DoLoop(int result) { |
| 177 TRACE_EVENT0("net", "SSLConnectJob::DoLoop"); |
175 DCHECK_NE(next_state_, STATE_NONE); | 178 DCHECK_NE(next_state_, STATE_NONE); |
176 | 179 |
177 int rv = result; | 180 int rv = result; |
178 do { | 181 do { |
179 State state = next_state_; | 182 State state = next_state_; |
180 next_state_ = STATE_NONE; | 183 next_state_ = STATE_NONE; |
181 switch (state) { | 184 switch (state) { |
182 case STATE_TRANSPORT_CONNECT: | 185 case STATE_TRANSPORT_CONNECT: |
183 DCHECK_EQ(OK, rv); | 186 DCHECK_EQ(OK, rv); |
184 rv = DoTransportConnect(); | 187 rv = DoTransportConnect(); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 if (base_.CloseOneIdleSocket()) | 672 if (base_.CloseOneIdleSocket()) |
670 return true; | 673 return true; |
671 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 674 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
672 } | 675 } |
673 | 676 |
674 void SSLClientSocketPool::OnSSLConfigChanged() { | 677 void SSLClientSocketPool::OnSSLConfigChanged() { |
675 FlushWithError(ERR_NETWORK_CHANGED); | 678 FlushWithError(ERR_NETWORK_CHANGED); |
676 } | 679 } |
677 | 680 |
678 } // namespace net | 681 } // namespace net |
OLD | NEW |