| OLD | NEW |
| 1 // Copyright (c) 2009 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 // A ClientSocketPoolBase is used to restrict the number of sockets open at | 5 // A ClientSocketPoolBase is used to restrict the number of sockets open at |
| 6 // a time. It also maintains a list of idle persistent sockets for reuse. | 6 // a time. It also maintains a list of idle persistent sockets for reuse. |
| 7 // Subclasses of ClientSocketPool should compose ClientSocketPoolBase to handle | 7 // Subclasses of ClientSocketPool should compose ClientSocketPoolBase to handle |
| 8 // the core logic of (1) restricting the number of active (connected or | 8 // the core logic of (1) restricting the number of active (connected or |
| 9 // connecting) sockets per "group" (generally speaking, the hostname), (2) | 9 // connecting) sockets per "group" (generally speaking, the hostname), (2) |
| 10 // maintaining a per-group list of idle, persistent sockets for reuse, and (3) | 10 // maintaining a per-group list of idle, persistent sockets for reuse, and (3) |
| 11 // limiting the total number of active sockets in the system. | 11 // limiting the total number of active sockets in the system. |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory); | 419 DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory); |
| 420 }; | 420 }; |
| 421 | 421 |
| 422 ClientSocketPoolBase(int max_sockets, | 422 ClientSocketPoolBase(int max_sockets, |
| 423 int max_sockets_per_group, | 423 int max_sockets_per_group, |
| 424 ConnectJobFactory* connect_job_factory) | 424 ConnectJobFactory* connect_job_factory) |
| 425 : helper_(new internal::ClientSocketPoolBaseHelper( | 425 : helper_(new internal::ClientSocketPoolBaseHelper( |
| 426 max_sockets, max_sockets_per_group, | 426 max_sockets, max_sockets_per_group, |
| 427 new ConnectJobFactoryAdaptor(connect_job_factory))) {} | 427 new ConnectJobFactoryAdaptor(connect_job_factory))) {} |
| 428 | 428 |
| 429 virtual ~ClientSocketPoolBase() {} | 429 ~ClientSocketPoolBase() {} |
| 430 | 430 |
| 431 // These member functions simply forward to ClientSocketPoolBaseHelper. | 431 // These member functions simply forward to ClientSocketPoolBaseHelper. |
| 432 | 432 |
| 433 // RequestSocket bundles up the parameters into a Request and then forwards to | 433 // RequestSocket bundles up the parameters into a Request and then forwards to |
| 434 // ClientSocketPoolBaseHelper::RequestSocket(). Note that the memory | 434 // ClientSocketPoolBaseHelper::RequestSocket(). Note that the memory |
| 435 // ownership is transferred in the asynchronous (ERR_IO_PENDING) case. | 435 // ownership is transferred in the asynchronous (ERR_IO_PENDING) case. |
| 436 int RequestSocket(const std::string& group_name, | 436 int RequestSocket(const std::string& group_name, |
| 437 const SocketParams& params, | 437 const SocketParams& params, |
| 438 int priority, | 438 int priority, |
| 439 ClientSocketHandle* handle, | 439 ClientSocketHandle* handle, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 // decoupled from socket connection jobs. A socket request may initiate a | 529 // decoupled from socket connection jobs. A socket request may initiate a |
| 530 // socket connection job, but there is no guarantee that that socket | 530 // socket connection job, but there is no guarantee that that socket |
| 531 // connection will service the request (for example, a released socket may | 531 // connection will service the request (for example, a released socket may |
| 532 // service the request sooner, or a higher priority request may come in | 532 // service the request sooner, or a higher priority request may come in |
| 533 // afterward and receive the socket from the job). | 533 // afterward and receive the socket from the job). |
| 534 void EnableLateBindingOfSockets(bool enabled); | 534 void EnableLateBindingOfSockets(bool enabled); |
| 535 | 535 |
| 536 } // namespace net | 536 } // namespace net |
| 537 | 537 |
| 538 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 538 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
| OLD | NEW |