OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_HANDLE_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return ssl_error_response_info_; | 125 return ssl_error_response_info_; |
126 } | 126 } |
127 ClientSocketHandle* release_pending_http_proxy_connection() { | 127 ClientSocketHandle* release_pending_http_proxy_connection() { |
128 return pending_http_proxy_connection_.release(); | 128 return pending_http_proxy_connection_.release(); |
129 } | 129 } |
130 | 130 |
131 // These may only be used if is_initialized() is true. | 131 // These may only be used if is_initialized() is true. |
132 const std::string& group_name() const { return group_name_; } | 132 const std::string& group_name() const { return group_name_; } |
133 int id() const { return pool_id_; } | 133 int id() const { return pool_id_; } |
134 ClientSocket* socket() { return socket_.get(); } | 134 ClientSocket* socket() { return socket_.get(); } |
135 ClientSocket* release_socket() { return socket_.release(); } | 135 ClientSocket* release_socket() { |
| 136 // Update the base class to record things like whether we've ever |
| 137 // transmitted data, and whether the connection was able to be established. |
| 138 // We use this data to construct histograms indicating whether a |
| 139 // speculative connection was ever used, etc., when the ClientSocket is |
| 140 // eventually discarded. |
| 141 if (socket_.get()) |
| 142 socket_->UpdateConnectivityState(is_reused()); |
| 143 return socket_.release(); |
| 144 } |
136 bool is_reused() const { return is_reused_; } | 145 bool is_reused() const { return is_reused_; } |
137 base::TimeDelta idle_time() const { return idle_time_; } | 146 base::TimeDelta idle_time() const { return idle_time_; } |
138 SocketReuseType reuse_type() const { | 147 SocketReuseType reuse_type() const { |
139 if (is_reused()) { | 148 if (is_reused()) { |
140 return REUSED_IDLE; | 149 return REUSED_IDLE; |
141 } else if (idle_time() == base::TimeDelta()) { | 150 } else if (idle_time() == base::TimeDelta()) { |
142 return UNUSED; | 151 return UNUSED; |
143 } else { | 152 } else { |
144 return UNUSED_IDLE; | 153 return UNUSED_IDLE; |
145 } | 154 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 user_callback_ = callback; | 229 user_callback_ = callback; |
221 } else { | 230 } else { |
222 HandleInitCompletion(rv); | 231 HandleInitCompletion(rv); |
223 } | 232 } |
224 return rv; | 233 return rv; |
225 } | 234 } |
226 | 235 |
227 } // namespace net | 236 } // namespace net |
228 | 237 |
229 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 238 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
OLD | NEW |