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/transport_client_socket_pool.h" | 5 #include "net/socket/transport_client_socket_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 const std::string& group_name, | 96 const std::string& group_name, |
97 RequestPriority priority, | 97 RequestPriority priority, |
98 ClientSocketPool::RespectLimits respect_limits, | 98 ClientSocketPool::RespectLimits respect_limits, |
99 const scoped_refptr<TransportSocketParams>& params, | 99 const scoped_refptr<TransportSocketParams>& params, |
100 base::TimeDelta timeout_duration, | 100 base::TimeDelta timeout_duration, |
101 ClientSocketFactory* client_socket_factory, | 101 ClientSocketFactory* client_socket_factory, |
102 SocketPerformanceWatcherFactory* socket_performance_watcher_factory, | 102 SocketPerformanceWatcherFactory* socket_performance_watcher_factory, |
103 HostResolver* host_resolver, | 103 HostResolver* host_resolver, |
104 Delegate* delegate, | 104 Delegate* delegate, |
105 NetLog* net_log) | 105 NetLog* net_log) |
106 : ConnectJob(group_name, | 106 : ConnectJob( |
107 timeout_duration, | 107 group_name, |
108 priority, | 108 timeout_duration, |
109 respect_limits, | 109 priority, |
110 delegate, | 110 respect_limits, |
111 BoundNetLog::Make(net_log, NetLogSourceType::CONNECT_JOB)), | 111 delegate, |
| 112 NetLogWithSource::Make(net_log, NetLogSourceType::CONNECT_JOB)), |
112 params_(params), | 113 params_(params), |
113 resolver_(host_resolver), | 114 resolver_(host_resolver), |
114 client_socket_factory_(client_socket_factory), | 115 client_socket_factory_(client_socket_factory), |
115 next_state_(STATE_NONE), | 116 next_state_(STATE_NONE), |
116 socket_performance_watcher_factory_(socket_performance_watcher_factory), | 117 socket_performance_watcher_factory_(socket_performance_watcher_factory), |
117 interval_between_connects_(CONNECT_INTERVAL_GT_20MS), | 118 interval_between_connects_(CONNECT_INTERVAL_GT_20MS), |
118 resolve_result_(OK) {} | 119 resolve_result_(OK) {} |
119 | 120 |
120 TransportConnectJob::~TransportConnectJob() { | 121 TransportConnectJob::~TransportConnectJob() { |
121 // We don't worry about cancelling the host resolution and TCP connect, since | 122 // We don't worry about cancelling the host resolution and TCP connect, since |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 552 } |
552 | 553 |
553 TransportClientSocketPool::~TransportClientSocketPool() {} | 554 TransportClientSocketPool::~TransportClientSocketPool() {} |
554 | 555 |
555 int TransportClientSocketPool::RequestSocket(const std::string& group_name, | 556 int TransportClientSocketPool::RequestSocket(const std::string& group_name, |
556 const void* params, | 557 const void* params, |
557 RequestPriority priority, | 558 RequestPriority priority, |
558 RespectLimits respect_limits, | 559 RespectLimits respect_limits, |
559 ClientSocketHandle* handle, | 560 ClientSocketHandle* handle, |
560 const CompletionCallback& callback, | 561 const CompletionCallback& callback, |
561 const BoundNetLog& net_log) { | 562 const NetLogWithSource& net_log) { |
562 const scoped_refptr<TransportSocketParams>* casted_params = | 563 const scoped_refptr<TransportSocketParams>* casted_params = |
563 static_cast<const scoped_refptr<TransportSocketParams>*>(params); | 564 static_cast<const scoped_refptr<TransportSocketParams>*>(params); |
564 | 565 |
565 NetLogTcpClientSocketPoolRequestedSocket(net_log, casted_params); | 566 NetLogTcpClientSocketPoolRequestedSocket(net_log, casted_params); |
566 | 567 |
567 return base_.RequestSocket(group_name, *casted_params, priority, | 568 return base_.RequestSocket(group_name, *casted_params, priority, |
568 respect_limits, handle, callback, net_log); | 569 respect_limits, handle, callback, net_log); |
569 } | 570 } |
570 | 571 |
571 void TransportClientSocketPool::NetLogTcpClientSocketPoolRequestedSocket( | 572 void TransportClientSocketPool::NetLogTcpClientSocketPoolRequestedSocket( |
572 const BoundNetLog& net_log, | 573 const NetLogWithSource& net_log, |
573 const scoped_refptr<TransportSocketParams>* casted_params) { | 574 const scoped_refptr<TransportSocketParams>* casted_params) { |
574 if (net_log.IsCapturing()) { | 575 if (net_log.IsCapturing()) { |
575 // TODO(eroman): Split out the host and port parameters. | 576 // TODO(eroman): Split out the host and port parameters. |
576 net_log.AddEvent( | 577 net_log.AddEvent( |
577 NetLogEventType::TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKET, | 578 NetLogEventType::TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKET, |
578 CreateNetLogHostPortPairCallback( | 579 CreateNetLogHostPortPairCallback( |
579 &casted_params->get()->destination().host_port_pair())); | 580 &casted_params->get()->destination().host_port_pair())); |
580 } | 581 } |
581 } | 582 } |
582 | 583 |
583 void TransportClientSocketPool::RequestSockets( | 584 void TransportClientSocketPool::RequestSockets( |
584 const std::string& group_name, | 585 const std::string& group_name, |
585 const void* params, | 586 const void* params, |
586 int num_sockets, | 587 int num_sockets, |
587 const BoundNetLog& net_log) { | 588 const NetLogWithSource& net_log) { |
588 const scoped_refptr<TransportSocketParams>* casted_params = | 589 const scoped_refptr<TransportSocketParams>* casted_params = |
589 static_cast<const scoped_refptr<TransportSocketParams>*>(params); | 590 static_cast<const scoped_refptr<TransportSocketParams>*>(params); |
590 | 591 |
591 if (net_log.IsCapturing()) { | 592 if (net_log.IsCapturing()) { |
592 // TODO(eroman): Split out the host and port parameters. | 593 // TODO(eroman): Split out the host and port parameters. |
593 net_log.AddEvent( | 594 net_log.AddEvent( |
594 NetLogEventType::TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKETS, | 595 NetLogEventType::TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKETS, |
595 CreateNetLogHostPortPairCallback( | 596 CreateNetLogHostPortPairCallback( |
596 &casted_params->get()->destination().host_port_pair())); | 597 &casted_params->get()->destination().host_port_pair())); |
597 } | 598 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 HigherLayeredPool* higher_pool) { | 654 HigherLayeredPool* higher_pool) { |
654 base_.AddHigherLayeredPool(higher_pool); | 655 base_.AddHigherLayeredPool(higher_pool); |
655 } | 656 } |
656 | 657 |
657 void TransportClientSocketPool::RemoveHigherLayeredPool( | 658 void TransportClientSocketPool::RemoveHigherLayeredPool( |
658 HigherLayeredPool* higher_pool) { | 659 HigherLayeredPool* higher_pool) { |
659 base_.RemoveHigherLayeredPool(higher_pool); | 660 base_.RemoveHigherLayeredPool(higher_pool); |
660 } | 661 } |
661 | 662 |
662 } // namespace net | 663 } // namespace net |
OLD | NEW |