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

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

Issue 1120007: Disable backup connect jobs for all pools except TCPClientSocketPool (Closed)
Patch Set: Created 10 years, 9 months 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
« no previous file with comments | « net/socket/client_socket_pool_base.h ('k') | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/socket/client_socket_pool_base.h" 5 #include "net/socket/client_socket_pool_base.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stats_counters.h" 10 #include "base/stats_counters.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 : idle_socket_count_(0), 109 : idle_socket_count_(0),
110 connecting_socket_count_(0), 110 connecting_socket_count_(0),
111 handed_out_socket_count_(0), 111 handed_out_socket_count_(0),
112 max_sockets_(max_sockets), 112 max_sockets_(max_sockets),
113 max_sockets_per_group_(max_sockets_per_group), 113 max_sockets_per_group_(max_sockets_per_group),
114 unused_idle_socket_timeout_(unused_idle_socket_timeout), 114 unused_idle_socket_timeout_(unused_idle_socket_timeout),
115 used_idle_socket_timeout_(used_idle_socket_timeout), 115 used_idle_socket_timeout_(used_idle_socket_timeout),
116 may_have_stalled_group_(false), 116 may_have_stalled_group_(false),
117 connect_job_factory_(connect_job_factory), 117 connect_job_factory_(connect_job_factory),
118 network_change_notifier_(network_change_notifier), 118 network_change_notifier_(network_change_notifier),
119 backup_jobs_enabled_(false),
119 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { 120 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
120 DCHECK_LE(0, max_sockets_per_group); 121 DCHECK_LE(0, max_sockets_per_group);
121 DCHECK_LE(max_sockets_per_group, max_sockets); 122 DCHECK_LE(max_sockets_per_group, max_sockets);
122 123
123 if (network_change_notifier_) 124 if (network_change_notifier_)
124 network_change_notifier_->AddObserver(this); 125 network_change_notifier_->AddObserver(this);
125 } 126 }
126 127
127 ClientSocketPoolBaseHelper::~ClientSocketPoolBaseHelper() { 128 ClientSocketPoolBaseHelper::~ClientSocketPoolBaseHelper() {
128 CancelAllConnectJobs(); 129 CancelAllConnectJobs();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 job_net_log.source().id); 237 job_net_log.source().id);
237 } 238 }
238 239
239 if (rv == OK) { 240 if (rv == OK) {
240 HandOutSocket(connect_job->ReleaseSocket(), false /* not reused */, 241 HandOutSocket(connect_job->ReleaseSocket(), false /* not reused */,
241 handle, base::TimeDelta(), &group, request->net_log()); 242 handle, base::TimeDelta(), &group, request->net_log());
242 } else if (rv == ERR_IO_PENDING) { 243 } else if (rv == ERR_IO_PENDING) {
243 // If we don't have any sockets in this group, set a timer for potentially 244 // If we don't have any sockets in this group, set a timer for potentially
244 // creating a new one. If the SYN is lost, this backup socket may complete 245 // creating a new one. If the SYN is lost, this backup socket may complete
245 // before the slow socket, improving end user latency. 246 // before the slow socket, improving end user latency.
246 if (group.IsEmpty() && !group.backup_job) { 247 if (group.IsEmpty() && !group.backup_job && backup_jobs_enabled_) {
247 group.backup_job = connect_job_factory_->NewConnectJob(group_name, 248 group.backup_job = connect_job_factory_->NewConnectJob(group_name,
248 *request, 249 *request,
249 this, 250 this,
250 job_net_log); 251 job_net_log);
251 StartBackupSocketTimer(group_name); 252 StartBackupSocketTimer(group_name);
252 } 253 }
253 254
254 connecting_socket_count_++; 255 connecting_socket_count_++;
255 256
256 ConnectJob* job = connect_job.release(); 257 ConnectJob* job = connect_job.release();
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 bool ClientSocketPoolBaseHelper::ReachedMaxSocketsLimit() const { 708 bool ClientSocketPoolBaseHelper::ReachedMaxSocketsLimit() const {
708 // Each connecting socket will eventually connect and be handed out. 709 // Each connecting socket will eventually connect and be handed out.
709 int total = handed_out_socket_count_ + connecting_socket_count_; 710 int total = handed_out_socket_count_ + connecting_socket_count_;
710 DCHECK_LE(total, max_sockets_); 711 DCHECK_LE(total, max_sockets_);
711 return total == max_sockets_; 712 return total == max_sockets_;
712 } 713 }
713 714
714 } // namespace internal 715 } // namespace internal
715 716
716 } // namespace net 717 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base.h ('k') | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698