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 #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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // Disconnect method. This will result in the ClientSocketPool deleting the | 87 // Disconnect method. This will result in the ClientSocketPool deleting the |
88 // StreamSocket. | 88 // StreamSocket. |
89 void Reset(); | 89 void Reset(); |
90 | 90 |
91 // Used after Init() is called, but before the ClientSocketPool has | 91 // Used after Init() is called, but before the ClientSocketPool has |
92 // initialized the ClientSocketHandle. | 92 // initialized the ClientSocketHandle. |
93 LoadState GetLoadState() const; | 93 LoadState GetLoadState() const; |
94 | 94 |
95 bool IsPoolStalled() const; | 95 bool IsPoolStalled() const; |
96 | 96 |
97 void AddLayeredPool(LayeredPool* layered_pool); | 97 // Adds a higher layered pool on top of the socket pool that |socket_| belongs |
| 98 // to. At most one higher layered pool can be added to a |
| 99 // ClientSocketHandle at a time. On destruction or reset, automatically |
| 100 // removes the higher pool if RemoveHigherLayeredPool has not been called. |
| 101 void AddHigherLayeredPool(HigherLayeredPool* higher_pool); |
98 | 102 |
99 void RemoveLayeredPool(LayeredPool* layered_pool); | 103 // Removes a higher layered pool from the socket pool that |socket_| belongs |
| 104 // to. |higher_pool| must have been added by the above function. |
| 105 void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool); |
100 | 106 |
101 // Returns true when Init() has completed successfully. | 107 // Returns true when Init() has completed successfully. |
102 bool is_initialized() const { return is_initialized_; } | 108 bool is_initialized() const { return is_initialized_; } |
103 | 109 |
104 // Returns the time tick when Init() was called. | 110 // Returns the time tick when Init() was called. |
105 base::TimeTicks init_time() const { return init_time_; } | 111 base::TimeTicks init_time() const { return init_time_; } |
106 | 112 |
107 // Returns the time between Init() and when is_initialized() becomes true. | 113 // Returns the time between Init() and when is_initialized() becomes true. |
108 base::TimeDelta setup_time() const { return setup_time_; } | 114 base::TimeDelta setup_time() const { return setup_time_; } |
109 | 115 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Resets the state of the ClientSocketHandle. |cancel| indicates whether or | 183 // Resets the state of the ClientSocketHandle. |cancel| indicates whether or |
178 // not to try to cancel the request with the ClientSocketPool. Does not | 184 // not to try to cancel the request with the ClientSocketPool. Does not |
179 // reset the supplemental error state. | 185 // reset the supplemental error state. |
180 void ResetInternal(bool cancel); | 186 void ResetInternal(bool cancel); |
181 | 187 |
182 // Resets the supplemental error state. | 188 // Resets the supplemental error state. |
183 void ResetErrorState(); | 189 void ResetErrorState(); |
184 | 190 |
185 bool is_initialized_; | 191 bool is_initialized_; |
186 ClientSocketPool* pool_; | 192 ClientSocketPool* pool_; |
187 LayeredPool* layered_pool_; | 193 HigherLayeredPool* higher_pool_; |
188 scoped_ptr<StreamSocket> socket_; | 194 scoped_ptr<StreamSocket> socket_; |
189 std::string group_name_; | 195 std::string group_name_; |
190 bool is_reused_; | 196 bool is_reused_; |
191 CompletionCallback callback_; | 197 CompletionCallback callback_; |
192 CompletionCallback user_callback_; | 198 CompletionCallback user_callback_; |
193 base::TimeDelta idle_time_; | 199 base::TimeDelta idle_time_; |
194 int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation. | 200 int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation. |
195 bool is_ssl_error_; | 201 bool is_ssl_error_; |
196 HttpResponseInfo ssl_error_response_info_; | 202 HttpResponseInfo ssl_error_response_info_; |
197 scoped_ptr<ClientSocketHandle> pending_http_proxy_connection_; | 203 scoped_ptr<ClientSocketHandle> pending_http_proxy_connection_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 user_callback_ = callback; | 235 user_callback_ = callback; |
230 } else { | 236 } else { |
231 HandleInitCompletion(rv); | 237 HandleInitCompletion(rv); |
232 } | 238 } |
233 return rv; | 239 return rv; |
234 } | 240 } |
235 | 241 |
236 } // namespace net | 242 } // namespace net |
237 | 243 |
238 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 244 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
OLD | NEW |