| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/base/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/field_trial.h" | 8 #include "base/field_trial.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "base/stl_util-inl.h" | 11 #include "base/stl_util-inl.h" |
| 12 #include "net/base/client_socket_factory.h" | |
| 13 #include "net/base/client_socket_handle.h" | |
| 14 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 15 #include "net/base/tcp_client_socket.h" | 13 #include "net/socket/client_socket_factory.h" |
| 14 #include "net/socket/client_socket_handle.h" |
| 15 #include "net/socket/tcp_client_socket.h" |
| 16 | 16 |
| 17 using base::TimeDelta; | 17 using base::TimeDelta; |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // The timeout value, in seconds, used to clean up idle sockets that can't be | 21 // The timeout value, in seconds, used to clean up idle sockets that can't be |
| 22 // reused. | 22 // reused. |
| 23 // | 23 // |
| 24 // Note: It's important to close idle sockets that have received data as soon | 24 // Note: It's important to close idle sockets that have received data as soon |
| 25 // as possible because the received data may cause BSOD on Windows XP under | 25 // as possible because the received data may cause BSOD on Windows XP under |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 connecting_socket_map_.erase(it); | 482 connecting_socket_map_.erase(it); |
| 483 } | 483 } |
| 484 | 484 |
| 485 void ClientSocketPoolBase::ProcessPendingRequest(const std::string& group_name, | 485 void ClientSocketPoolBase::ProcessPendingRequest(const std::string& group_name, |
| 486 Group* group) { | 486 Group* group) { |
| 487 Request r = group->pending_requests.front(); | 487 Request r = group->pending_requests.front(); |
| 488 group->pending_requests.pop_front(); | 488 group->pending_requests.pop_front(); |
| 489 | 489 |
| 490 int rv = RequestSocket( | 490 int rv = RequestSocket( |
| 491 group_name, r.resolve_info, r.priority, r.handle, r.callback); | 491 group_name, r.resolve_info, r.priority, r.handle, r.callback); |
| 492 | 492 |
| 493 // |group| may be invalid after RequestSocket. | 493 // |group| may be invalid after RequestSocket. |
| 494 | 494 |
| 495 if (rv != ERR_IO_PENDING) | 495 if (rv != ERR_IO_PENDING) |
| 496 r.callback->Run(rv); | 496 r.callback->Run(rv); |
| 497 } | 497 } |
| 498 | 498 |
| 499 ConnectingSocket* | 499 ConnectingSocket* |
| 500 TCPClientSocketPool::TCPConnectingSocketFactory::NewConnectingSocket( | 500 TCPClientSocketPool::TCPConnectingSocketFactory::NewConnectingSocket( |
| 501 const std::string& group_name, | 501 const std::string& group_name, |
| 502 const ClientSocketPoolBase::Request& request, | 502 const ClientSocketPoolBase::Request& request, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 const std::string& group_name) const { | 546 const std::string& group_name) const { |
| 547 return base_->IdleSocketCountInGroup(group_name); | 547 return base_->IdleSocketCountInGroup(group_name); |
| 548 } | 548 } |
| 549 | 549 |
| 550 LoadState TCPClientSocketPool::GetLoadState( | 550 LoadState TCPClientSocketPool::GetLoadState( |
| 551 const std::string& group_name, const ClientSocketHandle* handle) const { | 551 const std::string& group_name, const ClientSocketHandle* handle) const { |
| 552 return base_->GetLoadState(group_name, handle); | 552 return base_->GetLoadState(group_name, handle); |
| 553 } | 553 } |
| 554 | 554 |
| 555 } // namespace net | 555 } // namespace net |
| OLD | NEW |