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 #include "net/socket/tcp_client_socket_pool.h" | 5 #include "net/socket/tcp_client_socket_pool.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ClientSocketHandle* handle, | 215 ClientSocketHandle* handle, |
216 CompletionCallback* callback, | 216 CompletionCallback* callback, |
217 const BoundNetLog& net_log) { | 217 const BoundNetLog& net_log) { |
218 const scoped_refptr<TCPSocketParams>* casted_params = | 218 const scoped_refptr<TCPSocketParams>* casted_params = |
219 static_cast<const scoped_refptr<TCPSocketParams>*>(params); | 219 static_cast<const scoped_refptr<TCPSocketParams>*>(params); |
220 | 220 |
221 if (net_log.IsLoggingAllEvents()) { | 221 if (net_log.IsLoggingAllEvents()) { |
222 // TODO(eroman): Split out the host and port parameters. | 222 // TODO(eroman): Split out the host and port parameters. |
223 net_log.AddEvent( | 223 net_log.AddEvent( |
224 NetLog::TYPE_TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKET, | 224 NetLog::TYPE_TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKET, |
225 new NetLogStringParameter( | 225 make_scoped_refptr(new NetLogStringParameter( |
226 "host_and_port", | 226 "host_and_port", |
227 casted_params->get()->destination().host_port_pair().ToString())); | 227 casted_params->get()->destination().host_port_pair().ToString()))); |
228 } | 228 } |
229 | 229 |
230 return base_.RequestSocket(group_name, *casted_params, priority, handle, | 230 return base_.RequestSocket(group_name, *casted_params, priority, handle, |
231 callback, net_log); | 231 callback, net_log); |
232 } | 232 } |
233 | 233 |
234 void TCPClientSocketPool::RequestSockets( | 234 void TCPClientSocketPool::RequestSockets( |
235 const std::string& group_name, | 235 const std::string& group_name, |
236 const void* params, | 236 const void* params, |
237 int num_sockets, | 237 int num_sockets, |
238 const BoundNetLog& net_log) { | 238 const BoundNetLog& net_log) { |
239 const scoped_refptr<TCPSocketParams>* casted_params = | 239 const scoped_refptr<TCPSocketParams>* casted_params = |
240 static_cast<const scoped_refptr<TCPSocketParams>*>(params); | 240 static_cast<const scoped_refptr<TCPSocketParams>*>(params); |
241 | 241 |
242 if (net_log.IsLoggingAllEvents()) { | 242 if (net_log.IsLoggingAllEvents()) { |
243 // TODO(eroman): Split out the host and port parameters. | 243 // TODO(eroman): Split out the host and port parameters. |
244 net_log.AddEvent( | 244 net_log.AddEvent( |
245 NetLog::TYPE_TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKETS, | 245 NetLog::TYPE_TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKETS, |
246 new NetLogStringParameter( | 246 make_scoped_refptr(new NetLogStringParameter( |
247 "host_and_port", | 247 "host_and_port", |
248 casted_params->get()->destination().host_port_pair().ToString())); | 248 casted_params->get()->destination().host_port_pair().ToString()))); |
249 } | 249 } |
250 | 250 |
251 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); | 251 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); |
252 } | 252 } |
253 | 253 |
254 void TCPClientSocketPool::CancelRequest( | 254 void TCPClientSocketPool::CancelRequest( |
255 const std::string& group_name, | 255 const std::string& group_name, |
256 ClientSocketHandle* handle) { | 256 ClientSocketHandle* handle) { |
257 base_.CancelRequest(group_name, handle); | 257 base_.CancelRequest(group_name, handle); |
258 } | 258 } |
(...skipping 17 matching lines...) Expand all Loading... |
276 const std::string& group_name) const { | 276 const std::string& group_name) const { |
277 return base_.IdleSocketCountInGroup(group_name); | 277 return base_.IdleSocketCountInGroup(group_name); |
278 } | 278 } |
279 | 279 |
280 LoadState TCPClientSocketPool::GetLoadState( | 280 LoadState TCPClientSocketPool::GetLoadState( |
281 const std::string& group_name, const ClientSocketHandle* handle) const { | 281 const std::string& group_name, const ClientSocketHandle* handle) const { |
282 return base_.GetLoadState(group_name, handle); | 282 return base_.GetLoadState(group_name, handle); |
283 } | 283 } |
284 | 284 |
285 } // namespace net | 285 } // namespace net |
OLD | NEW |