Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: net/socket/client_socket_pool_manager.cc

Issue 8340012: Close idle connections / SPDY sessions when needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OVERRIDE Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a 5 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a
6 // simple container for all of them. Most importantly, it handles the lifetime 6 // simple container for all of them. Most importantly, it handles the lifetime
7 // and destruction order properly. 7 // and destruction order properly.
8 8
9 #include "net/socket/client_socket_pool_manager.h" 9 #include "net/socket/client_socket_pool_manager.h"
10 10
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 net_log_); 541 net_log_);
542 542
543 std::pair<SSLSocketPoolMap::iterator, bool> ret = 543 std::pair<SSLSocketPoolMap::iterator, bool> ret =
544 ssl_socket_pools_for_proxies_.insert(std::make_pair(proxy_server, 544 ssl_socket_pools_for_proxies_.insert(std::make_pair(proxy_server,
545 new_pool)); 545 new_pool));
546 546
547 return ret.first->second; 547 return ret.first->second;
548 } 548 }
549 549
550 // static 550 // static
551 int ClientSocketPoolManager::max_sockets_per_pool() {
552 return g_max_sockets_per_pool;
553 }
554
555 // static
551 void ClientSocketPoolManager::set_max_sockets_per_pool(int socket_count) { 556 void ClientSocketPoolManager::set_max_sockets_per_pool(int socket_count) {
552 DCHECK_LT(0, socket_count); 557 DCHECK_LT(0, socket_count);
553 DCHECK_GT(1000, socket_count); // Sanity check. 558 DCHECK_GT(1000, socket_count); // Sanity check.
554 g_max_sockets_per_pool = socket_count; 559 g_max_sockets_per_pool = socket_count;
555 DCHECK_GE(g_max_sockets_per_pool, g_max_sockets_per_group); 560 DCHECK_GE(g_max_sockets_per_pool, g_max_sockets_per_group);
556 } 561 }
557 562
558 // static 563 // static
559 int ClientSocketPoolManager::max_sockets_per_group() { 564 int ClientSocketPoolManager::max_sockets_per_group() {
560 return g_max_sockets_per_group; 565 return g_max_sockets_per_group;
561 } 566 }
562 567
563 // static 568 // static
564 void ClientSocketPoolManager::set_max_sockets_per_group(int socket_count) { 569 void ClientSocketPoolManager::set_max_sockets_per_group(int socket_count) {
565 DCHECK_LT(0, socket_count); 570 DCHECK_LT(0, socket_count);
566 // The following is a sanity check... but we should NEVER be near this value. 571 // The following is a sanity check... but we should NEVER be near this value.
567 DCHECK_GT(100, socket_count); 572 DCHECK_GT(100, socket_count);
568 g_max_sockets_per_group = socket_count; 573 g_max_sockets_per_group = socket_count;
569 574
570 DCHECK_GE(g_max_sockets_per_pool, g_max_sockets_per_group); 575 DCHECK_GE(g_max_sockets_per_pool, g_max_sockets_per_group);
571 DCHECK_GE(g_max_sockets_per_proxy_server, g_max_sockets_per_group); 576 DCHECK_GE(g_max_sockets_per_proxy_server, g_max_sockets_per_group);
572 } 577 }
573 578
574 // static 579 // static
580 int ClientSocketPoolManager::max_sockets_per_proxy_server() {
581 return g_max_sockets_per_proxy_server;
582 }
583
584 // static
575 void ClientSocketPoolManager::set_max_sockets_per_proxy_server( 585 void ClientSocketPoolManager::set_max_sockets_per_proxy_server(
576 int socket_count) { 586 int socket_count) {
577 DCHECK_LT(0, socket_count); 587 DCHECK_LT(0, socket_count);
578 DCHECK_GT(100, socket_count); // Sanity check. 588 DCHECK_GT(100, socket_count); // Sanity check.
579 // Assert this case early on. The max number of sockets per group cannot 589 // Assert this case early on. The max number of sockets per group cannot
580 // exceed the max number of sockets per proxy server. 590 // exceed the max number of sockets per proxy server.
581 DCHECK_LE(g_max_sockets_per_group, socket_count); 591 DCHECK_LE(g_max_sockets_per_group, socket_count);
582 g_max_sockets_per_proxy_server = socket_count; 592 g_max_sockets_per_proxy_server = socket_count;
583 } 593 }
584 594
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 ssl_config_for_proxy, 732 ssl_config_for_proxy,
723 false, 733 false,
724 net_log, 734 net_log,
725 num_preconnect_streams, 735 num_preconnect_streams,
726 NULL, 736 NULL,
727 NULL); 737 NULL);
728 } 738 }
729 739
730 740
731 } // namespace net 741 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698