| 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 UpdateConnectivityStateForSocket(); |
| 137 return socket_.release(); |
| 138 } |
| 136 bool is_reused() const { return is_reused_; } | 139 bool is_reused() const { return is_reused_; } |
| 137 base::TimeDelta idle_time() const { return idle_time_; } | 140 base::TimeDelta idle_time() const { return idle_time_; } |
| 138 SocketReuseType reuse_type() const { | 141 SocketReuseType reuse_type() const { |
| 139 if (is_reused()) { | 142 if (is_reused()) { |
| 140 return REUSED_IDLE; | 143 return REUSED_IDLE; |
| 141 } else if (idle_time() == base::TimeDelta()) { | 144 } else if (idle_time() == base::TimeDelta()) { |
| 142 return UNUSED; | 145 return UNUSED; |
| 143 } else { | 146 } else { |
| 144 return UNUSED_IDLE; | 147 return UNUSED_IDLE; |
| 145 } | 148 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 167 void HandleInitCompletion(int result); | 170 void HandleInitCompletion(int result); |
| 168 | 171 |
| 169 // Resets the state of the ClientSocketHandle. |cancel| indicates whether or | 172 // Resets the state of the ClientSocketHandle. |cancel| indicates whether or |
| 170 // not to try to cancel the request with the ClientSocketPool. Does not | 173 // not to try to cancel the request with the ClientSocketPool. Does not |
| 171 // reset the supplemental error state. | 174 // reset the supplemental error state. |
| 172 void ResetInternal(bool cancel); | 175 void ResetInternal(bool cancel); |
| 173 | 176 |
| 174 // Resets the supplemental error state. | 177 // Resets the supplemental error state. |
| 175 void ResetErrorState(); | 178 void ResetErrorState(); |
| 176 | 179 |
| 180 // Update the base class to record things like whether we've ever transmitted |
| 181 // data, and whether the connection was able to be established. We use this |
| 182 // data to construct histograms indicating whether a speculative connection |
| 183 // was ever used, etc., when the ClientSocket is eventually discarded. |
| 184 void UpdateConnectivityStateForSocket() const { |
| 185 if (socket_.get()) |
| 186 socket_->UpdateConnectivityState(is_reused()); |
| 187 } |
| 188 |
| 177 bool is_initialized_; | 189 bool is_initialized_; |
| 178 scoped_refptr<ClientSocketPool> pool_; | 190 scoped_refptr<ClientSocketPool> pool_; |
| 179 scoped_ptr<ClientSocket> socket_; | 191 scoped_ptr<ClientSocket> socket_; |
| 180 std::string group_name_; | 192 std::string group_name_; |
| 181 bool is_reused_; | 193 bool is_reused_; |
| 182 CompletionCallbackImpl<ClientSocketHandle> callback_; | 194 CompletionCallbackImpl<ClientSocketHandle> callback_; |
| 183 CompletionCallback* user_callback_; | 195 CompletionCallback* user_callback_; |
| 184 base::TimeDelta idle_time_; | 196 base::TimeDelta idle_time_; |
| 185 int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation. | 197 int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation. |
| 186 bool is_ssl_error_; | 198 bool is_ssl_error_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 user_callback_ = callback; | 232 user_callback_ = callback; |
| 221 } else { | 233 } else { |
| 222 HandleInitCompletion(rv); | 234 HandleInitCompletion(rv); |
| 223 } | 235 } |
| 224 return rv; | 236 return rv; |
| 225 } | 237 } |
| 226 | 238 |
| 227 } // namespace net | 239 } // namespace net |
| 228 | 240 |
| 229 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 241 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
| OLD | NEW |