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

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

Issue 10546162: NetLogEventParameter to Callback refactoring 9. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove comment Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/client_socket_handle.cc ('k') | net/socket/nss_ssl_util.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) 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/client_socket_pool_base.h" 5 #include "net/socket/client_socket_pool_base.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 base::TimeDelta timeout_duration, 70 base::TimeDelta timeout_duration,
71 Delegate* delegate, 71 Delegate* delegate,
72 const BoundNetLog& net_log) 72 const BoundNetLog& net_log)
73 : group_name_(group_name), 73 : group_name_(group_name),
74 timeout_duration_(timeout_duration), 74 timeout_duration_(timeout_duration),
75 delegate_(delegate), 75 delegate_(delegate),
76 net_log_(net_log), 76 net_log_(net_log),
77 idle_(true) { 77 idle_(true) {
78 DCHECK(!group_name.empty()); 78 DCHECK(!group_name.empty());
79 DCHECK(delegate); 79 DCHECK(delegate);
80 net_log.BeginEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB, NULL); 80 net_log.BeginEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB);
81 } 81 }
82 82
83 ConnectJob::~ConnectJob() { 83 ConnectJob::~ConnectJob() {
84 net_log().EndEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB, NULL); 84 net_log().EndEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB);
85 } 85 }
86 86
87 int ConnectJob::Connect() { 87 int ConnectJob::Connect() {
88 if (timeout_duration_ != base::TimeDelta()) 88 if (timeout_duration_ != base::TimeDelta())
89 timer_.Start(FROM_HERE, timeout_duration_, this, &ConnectJob::OnTimeout); 89 timer_.Start(FROM_HERE, timeout_duration_, this, &ConnectJob::OnTimeout);
90 90
91 idle_ = false; 91 idle_ = false;
92 92
93 LogConnectStart(); 93 LogConnectStart();
94 94
95 int rv = ConnectInternal(); 95 int rv = ConnectInternal();
96 96
97 if (rv != ERR_IO_PENDING) { 97 if (rv != ERR_IO_PENDING) {
98 LogConnectCompletion(rv); 98 LogConnectCompletion(rv);
99 delegate_ = NULL; 99 delegate_ = NULL;
100 } 100 }
101 101
102 return rv; 102 return rv;
103 } 103 }
104 104
105 void ConnectJob::set_socket(StreamSocket* socket) { 105 void ConnectJob::set_socket(StreamSocket* socket) {
106 if (socket) { 106 if (socket) {
107 net_log().AddEvent(NetLog::TYPE_CONNECT_JOB_SET_SOCKET, make_scoped_refptr( 107 net_log().AddEvent(NetLog::TYPE_CONNECT_JOB_SET_SOCKET,
108 new NetLogSourceParameter("source_dependency", 108 socket->NetLog().source().ToEventParametersCallback());
109 socket->NetLog().source())));
110 } 109 }
111 socket_.reset(socket); 110 socket_.reset(socket);
112 } 111 }
113 112
114 void ConnectJob::NotifyDelegateOfCompletion(int rv) { 113 void ConnectJob::NotifyDelegateOfCompletion(int rv) {
115 // The delegate will delete |this|. 114 // The delegate will delete |this|.
116 Delegate *delegate = delegate_; 115 Delegate *delegate = delegate_;
117 delegate_ = NULL; 116 delegate_ = NULL;
118 117
119 LogConnectCompletion(rv); 118 LogConnectCompletion(rv);
120 delegate->OnConnectJobComplete(rv, this); 119 delegate->OnConnectJobComplete(rv, this);
121 } 120 }
122 121
123 void ConnectJob::ResetTimer(base::TimeDelta remaining_time) { 122 void ConnectJob::ResetTimer(base::TimeDelta remaining_time) {
124 timer_.Stop(); 123 timer_.Stop();
125 timer_.Start(FROM_HERE, remaining_time, this, &ConnectJob::OnTimeout); 124 timer_.Start(FROM_HERE, remaining_time, this, &ConnectJob::OnTimeout);
126 } 125 }
127 126
128 void ConnectJob::LogConnectStart() { 127 void ConnectJob::LogConnectStart() {
129 net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT, 128 net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT,
130 make_scoped_refptr(new NetLogStringParameter("group_name", group_name_))); 129 NetLog::StringCallback("group_name", &group_name_));
131 } 130 }
132 131
133 void ConnectJob::LogConnectCompletion(int net_error) { 132 void ConnectJob::LogConnectCompletion(int net_error) {
134 net_log().EndEventWithNetErrorCode( 133 net_log().EndEventWithNetErrorCode(
135 NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT, net_error); 134 NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT, net_error);
136 } 135 }
137 136
138 void ConnectJob::OnTimeout() { 137 void ConnectJob::OnTimeout() {
139 // Make sure the socket is NULL before calling into |delegate|. 138 // Make sure the socket is NULL before calling into |delegate|.
140 set_socket(NULL); 139 set_socket(NULL);
141 140
142 net_log_.AddEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_TIMED_OUT, NULL); 141 net_log_.AddEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_TIMED_OUT);
143 142
144 NotifyDelegateOfCompletion(ERR_TIMED_OUT); 143 NotifyDelegateOfCompletion(ERR_TIMED_OUT);
145 } 144 }
146 145
147 namespace internal { 146 namespace internal {
148 147
149 ClientSocketPoolBaseHelper::Request::Request( 148 ClientSocketPoolBaseHelper::Request::Request(
150 ClientSocketHandle* handle, 149 ClientSocketHandle* handle,
151 const CompletionCallback& callback, 150 const CompletionCallback& callback,
152 RequestPriority priority, 151 RequestPriority priority,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 int ClientSocketPoolBaseHelper::RequestSocket( 240 int ClientSocketPoolBaseHelper::RequestSocket(
242 const std::string& group_name, 241 const std::string& group_name,
243 const Request* request) { 242 const Request* request) {
244 CHECK(!request->callback().is_null()); 243 CHECK(!request->callback().is_null());
245 CHECK(request->handle()); 244 CHECK(request->handle());
246 245
247 // Cleanup any timed-out idle sockets if no timer is used. 246 // Cleanup any timed-out idle sockets if no timer is used.
248 if (!use_cleanup_timer_) 247 if (!use_cleanup_timer_)
249 CleanupIdleSockets(false); 248 CleanupIdleSockets(false);
250 249
251 request->net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL, NULL); 250 request->net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL);
252 Group* group = GetOrCreateGroup(group_name); 251 Group* group = GetOrCreateGroup(group_name);
253 252
254 int rv = RequestSocketInternal(group_name, request); 253 int rv = RequestSocketInternal(group_name, request);
255 if (rv != ERR_IO_PENDING) { 254 if (rv != ERR_IO_PENDING) {
256 request->net_log().EndEventWithNetErrorCode(NetLog::TYPE_SOCKET_POOL, rv); 255 request->net_log().EndEventWithNetErrorCode(NetLog::TYPE_SOCKET_POOL, rv);
257 CHECK(!request->handle()->is_initialized()); 256 CHECK(!request->handle()->is_initialized());
258 delete request; 257 delete request;
259 } else { 258 } else {
260 InsertRequestIntoQueue(request, group->mutable_pending_requests()); 259 InsertRequestIntoQueue(request, group->mutable_pending_requests());
261 } 260 }
(...skipping 10 matching lines...) Expand all
272 // Cleanup any timed out idle sockets if no timer is used. 271 // Cleanup any timed out idle sockets if no timer is used.
273 if (!use_cleanup_timer_) 272 if (!use_cleanup_timer_)
274 CleanupIdleSockets(false); 273 CleanupIdleSockets(false);
275 274
276 if (num_sockets > max_sockets_per_group_) { 275 if (num_sockets > max_sockets_per_group_) {
277 num_sockets = max_sockets_per_group_; 276 num_sockets = max_sockets_per_group_;
278 } 277 }
279 278
280 request.net_log().BeginEvent( 279 request.net_log().BeginEvent(
281 NetLog::TYPE_SOCKET_POOL_CONNECTING_N_SOCKETS, 280 NetLog::TYPE_SOCKET_POOL_CONNECTING_N_SOCKETS,
282 make_scoped_refptr(new NetLogIntegerParameter( 281 NetLog::IntegerCallback("num_sockets", num_sockets));
283 "num_sockets", num_sockets)));
284 282
285 Group* group = GetOrCreateGroup(group_name); 283 Group* group = GetOrCreateGroup(group_name);
286 284
287 // RequestSocketsInternal() may delete the group. 285 // RequestSocketsInternal() may delete the group.
288 bool deleted_group = false; 286 bool deleted_group = false;
289 287
290 int rv = OK; 288 int rv = OK;
291 for (int num_iterations_left = num_sockets; 289 for (int num_iterations_left = num_sockets;
292 group->NumActiveSocketSlots() < num_sockets && 290 group->NumActiveSocketSlots() < num_sockets &&
293 num_iterations_left > 0 ; num_iterations_left--) { 291 num_iterations_left > 0 ; num_iterations_left--) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 return ERR_IO_PENDING; 334 return ERR_IO_PENDING;
337 335
338 // Can we make another active socket now? 336 // Can we make another active socket now?
339 if (!group->HasAvailableSocketSlot(max_sockets_per_group_) && 337 if (!group->HasAvailableSocketSlot(max_sockets_per_group_) &&
340 !request->ignore_limits()) { 338 !request->ignore_limits()) {
341 // TODO(willchan): Consider whether or not we need to close a socket in a 339 // TODO(willchan): Consider whether or not we need to close a socket in a
342 // higher layered group. I don't think this makes sense since we would just 340 // higher layered group. I don't think this makes sense since we would just
343 // reuse that socket then if we needed one and wouldn't make it down to this 341 // reuse that socket then if we needed one and wouldn't make it down to this
344 // layer. 342 // layer.
345 request->net_log().AddEvent( 343 request->net_log().AddEvent(
346 NetLog::TYPE_SOCKET_POOL_STALLED_MAX_SOCKETS_PER_GROUP, NULL); 344 NetLog::TYPE_SOCKET_POOL_STALLED_MAX_SOCKETS_PER_GROUP);
347 return ERR_IO_PENDING; 345 return ERR_IO_PENDING;
348 } 346 }
349 347
350 if (ReachedMaxSocketsLimit() && !request->ignore_limits()) { 348 if (ReachedMaxSocketsLimit() && !request->ignore_limits()) {
351 // NOTE(mmenke): Wonder if we really need different code for each case 349 // NOTE(mmenke): Wonder if we really need different code for each case
352 // here. Only reason for them now seems to be preconnects. 350 // here. Only reason for them now seems to be preconnects.
353 if (idle_socket_count() > 0) { 351 if (idle_socket_count() > 0) {
354 // There's an idle socket in this pool. Either that's because there's 352 // There's an idle socket in this pool. Either that's because there's
355 // still one in this group, but we got here due to preconnecting bypassing 353 // still one in this group, but we got here due to preconnecting bypassing
356 // idle sockets, or because there's an idle socket in another group. 354 // idle sockets, or because there's an idle socket in another group.
357 bool closed = CloseOneIdleSocketExceptInGroup(group); 355 bool closed = CloseOneIdleSocketExceptInGroup(group);
358 if (preconnecting && !closed) 356 if (preconnecting && !closed)
359 return ERR_PRECONNECT_MAX_SOCKET_LIMIT; 357 return ERR_PRECONNECT_MAX_SOCKET_LIMIT;
360 } else { 358 } else {
361 // We could check if we really have a stalled group here, but it requires 359 // We could check if we really have a stalled group here, but it requires
362 // a scan of all groups, so just flip a flag here, and do the check later. 360 // a scan of all groups, so just flip a flag here, and do the check later.
363 request->net_log().AddEvent( 361 request->net_log().AddEvent(NetLog::TYPE_SOCKET_POOL_STALLED_MAX_SOCKETS);
364 NetLog::TYPE_SOCKET_POOL_STALLED_MAX_SOCKETS, NULL);
365 return ERR_IO_PENDING; 362 return ERR_IO_PENDING;
366 } 363 }
367 } 364 }
368 365
369 // We couldn't find a socket to reuse, and there's space to allocate one, 366 // We couldn't find a socket to reuse, and there's space to allocate one,
370 // so allocate and connect a new one. 367 // so allocate and connect a new one.
371 scoped_ptr<ConnectJob> connect_job( 368 scoped_ptr<ConnectJob> connect_job(
372 connect_job_factory_->NewConnectJob(group_name, *request, this)); 369 connect_job_factory_->NewConnectJob(group_name, *request, this));
373 370
374 int rv = connect_job->Connect(); 371 int rv = connect_job->Connect();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 request->net_log()); 471 request->net_log());
475 return true; 472 return true;
476 } 473 }
477 474
478 return false; 475 return false;
479 } 476 }
480 477
481 // static 478 // static
482 void ClientSocketPoolBaseHelper::LogBoundConnectJobToRequest( 479 void ClientSocketPoolBaseHelper::LogBoundConnectJobToRequest(
483 const NetLog::Source& connect_job_source, const Request* request) { 480 const NetLog::Source& connect_job_source, const Request* request) {
484 request->net_log().AddEvent( 481 request->net_log().AddEvent(NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB,
485 NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB, 482 connect_job_source.ToEventParametersCallback());
486 make_scoped_refptr(new NetLogSourceParameter(
487 "source_dependency", connect_job_source)));
488 } 483 }
489 484
490 void ClientSocketPoolBaseHelper::CancelRequest( 485 void ClientSocketPoolBaseHelper::CancelRequest(
491 const std::string& group_name, ClientSocketHandle* handle) { 486 const std::string& group_name, ClientSocketHandle* handle) {
492 PendingCallbackMap::iterator callback_it = pending_callback_map_.find(handle); 487 PendingCallbackMap::iterator callback_it = pending_callback_map_.find(handle);
493 if (callback_it != pending_callback_map_.end()) { 488 if (callback_it != pending_callback_map_.end()) {
494 int result = callback_it->second.result; 489 int result = callback_it->second.result;
495 pending_callback_map_.erase(callback_it); 490 pending_callback_map_.erase(callback_it);
496 StreamSocket* socket = handle->release_socket(); 491 StreamSocket* socket = handle->release_socket();
497 if (socket) { 492 if (socket) {
498 if (result != OK) 493 if (result != OK)
499 socket->Disconnect(); 494 socket->Disconnect();
500 ReleaseSocket(handle->group_name(), socket, handle->id()); 495 ReleaseSocket(handle->group_name(), socket, handle->id());
501 } 496 }
502 return; 497 return;
503 } 498 }
504 499
505 CHECK(ContainsKey(group_map_, group_name)); 500 CHECK(ContainsKey(group_map_, group_name));
506 501
507 Group* group = GetOrCreateGroup(group_name); 502 Group* group = GetOrCreateGroup(group_name);
508 503
509 // Search pending_requests for matching handle. 504 // Search pending_requests for matching handle.
510 RequestQueue::iterator it = group->mutable_pending_requests()->begin(); 505 RequestQueue::iterator it = group->mutable_pending_requests()->begin();
511 for (; it != group->pending_requests().end(); ++it) { 506 for (; it != group->pending_requests().end(); ++it) {
512 if ((*it)->handle() == handle) { 507 if ((*it)->handle() == handle) {
513 scoped_ptr<const Request> req(RemoveRequestFromQueue(it, group)); 508 scoped_ptr<const Request> req(RemoveRequestFromQueue(it, group));
514 req->net_log().AddEvent(NetLog::TYPE_CANCELLED, NULL); 509 req->net_log().AddEvent(NetLog::TYPE_CANCELLED);
515 req->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, NULL); 510 req->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL);
516 511
517 // We let the job run, unless we're at the socket limit. 512 // We let the job run, unless we're at the socket limit.
518 if (group->jobs().size() && ReachedMaxSocketsLimit()) { 513 if (group->jobs().size() && ReachedMaxSocketsLimit()) {
519 RemoveConnectJob(*group->jobs().begin(), group); 514 RemoveConnectJob(*group->jobs().begin(), group);
520 CheckForStalledSocketGroups(); 515 CheckForStalledSocketGroups();
521 } 516 }
522 break; 517 break;
523 } 518 }
524 } 519 }
525 } 520 }
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 if (result == OK) { 850 if (result == OK) {
856 DCHECK(socket.get()); 851 DCHECK(socket.get());
857 RemoveConnectJob(job, group); 852 RemoveConnectJob(job, group);
858 if (!group->pending_requests().empty()) { 853 if (!group->pending_requests().empty()) {
859 scoped_ptr<const Request> r(RemoveRequestFromQueue( 854 scoped_ptr<const Request> r(RemoveRequestFromQueue(
860 group->mutable_pending_requests()->begin(), group)); 855 group->mutable_pending_requests()->begin(), group));
861 LogBoundConnectJobToRequest(job_log.source(), r.get()); 856 LogBoundConnectJobToRequest(job_log.source(), r.get());
862 HandOutSocket( 857 HandOutSocket(
863 socket.release(), false /* unused socket */, r->handle(), 858 socket.release(), false /* unused socket */, r->handle(),
864 base::TimeDelta(), group, r->net_log()); 859 base::TimeDelta(), group, r->net_log());
865 r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, NULL); 860 r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL);
866 InvokeUserCallbackLater(r->handle(), r->callback(), result); 861 InvokeUserCallbackLater(r->handle(), r->callback(), result);
867 } else { 862 } else {
868 AddIdleSocket(socket.release(), group); 863 AddIdleSocket(socket.release(), group);
869 OnAvailableSocketSlot(group_name, group); 864 OnAvailableSocketSlot(group_name, group);
870 CheckForStalledSocketGroups(); 865 CheckForStalledSocketGroups();
871 } 866 }
872 } else { 867 } else {
873 // If we got a socket, it must contain error information so pass that 868 // If we got a socket, it must contain error information so pass that
874 // up so that the caller can retrieve it. 869 // up so that the caller can retrieve it.
875 bool handed_out_socket = false; 870 bool handed_out_socket = false;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 const BoundNetLog& net_log) { 973 const BoundNetLog& net_log) {
979 DCHECK(socket); 974 DCHECK(socket);
980 handle->set_socket(socket); 975 handle->set_socket(socket);
981 handle->set_is_reused(reused); 976 handle->set_is_reused(reused);
982 handle->set_idle_time(idle_time); 977 handle->set_idle_time(idle_time);
983 handle->set_pool_id(pool_generation_number_); 978 handle->set_pool_id(pool_generation_number_);
984 979
985 if (reused) { 980 if (reused) {
986 net_log.AddEvent( 981 net_log.AddEvent(
987 NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET, 982 NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET,
988 make_scoped_refptr(new NetLogIntegerParameter( 983 NetLog::IntegerCallback(
989 "idle_ms", static_cast<int>(idle_time.InMilliseconds())))); 984 "idle_ms", static_cast<int>(idle_time.InMilliseconds())));
990 } 985 }
991 986
992 net_log.AddEvent(NetLog::TYPE_SOCKET_POOL_BOUND_TO_SOCKET, 987 net_log.AddEvent(NetLog::TYPE_SOCKET_POOL_BOUND_TO_SOCKET,
993 make_scoped_refptr(new NetLogSourceParameter( 988 socket->NetLog().source().ToEventParametersCallback());
994 "source_dependency", socket->NetLog().source())));
995 989
996 handed_out_socket_count_++; 990 handed_out_socket_count_++;
997 group->IncrementActiveSocketCount(); 991 group->IncrementActiveSocketCount();
998 } 992 }
999 993
1000 void ClientSocketPoolBaseHelper::AddIdleSocket( 994 void ClientSocketPoolBaseHelper::AddIdleSocket(
1001 StreamSocket* socket, Group* group) { 995 StreamSocket* socket, Group* group) {
1002 DCHECK(socket); 996 DCHECK(socket);
1003 IdleSocket idle_socket; 997 IdleSocket idle_socket;
1004 idle_socket.socket = socket; 998 idle_socket.socket = socket;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 (*jobs_.begin())->GetLoadState() == LOAD_STATE_RESOLVING_HOST) { 1192 (*jobs_.begin())->GetLoadState() == LOAD_STATE_RESOLVING_HOST) {
1199 StartBackupSocketTimer(group_name, pool); 1193 StartBackupSocketTimer(group_name, pool);
1200 return; 1194 return;
1201 } 1195 }
1202 1196
1203 if (pending_requests_.empty()) 1197 if (pending_requests_.empty())
1204 return; 1198 return;
1205 1199
1206 ConnectJob* backup_job = pool->connect_job_factory_->NewConnectJob( 1200 ConnectJob* backup_job = pool->connect_job_factory_->NewConnectJob(
1207 group_name, **pending_requests_.begin(), pool); 1201 group_name, **pending_requests_.begin(), pool);
1208 backup_job->net_log().AddEvent(NetLog::TYPE_SOCKET_BACKUP_CREATED, NULL); 1202 backup_job->net_log().AddEvent(NetLog::TYPE_SOCKET_BACKUP_CREATED);
1209 SIMPLE_STATS_COUNTER("socket.backup_created"); 1203 SIMPLE_STATS_COUNTER("socket.backup_created");
1210 int rv = backup_job->Connect(); 1204 int rv = backup_job->Connect();
1211 pool->connecting_socket_count_++; 1205 pool->connecting_socket_count_++;
1212 AddJob(backup_job, false); 1206 AddJob(backup_job, false);
1213 if (rv != ERR_IO_PENDING) 1207 if (rv != ERR_IO_PENDING)
1214 pool->OnConnectJobComplete(rv, backup_job); 1208 pool->OnConnectJobComplete(rv, backup_job);
1215 } 1209 }
1216 1210
1217 void ClientSocketPoolBaseHelper::Group::SanityCheck() { 1211 void ClientSocketPoolBaseHelper::Group::SanityCheck() {
1218 DCHECK_LE(unassigned_job_count_, jobs_.size()); 1212 DCHECK_LE(unassigned_job_count_, jobs_.size());
1219 } 1213 }
1220 1214
1221 void ClientSocketPoolBaseHelper::Group::RemoveAllJobs() { 1215 void ClientSocketPoolBaseHelper::Group::RemoveAllJobs() {
1222 SanityCheck(); 1216 SanityCheck();
1223 1217
1224 // Delete active jobs. 1218 // Delete active jobs.
1225 STLDeleteElements(&jobs_); 1219 STLDeleteElements(&jobs_);
1226 unassigned_job_count_ = 0; 1220 unassigned_job_count_ = 0;
1227 1221
1228 // Cancel pending backup job. 1222 // Cancel pending backup job.
1229 weak_factory_.InvalidateWeakPtrs(); 1223 weak_factory_.InvalidateWeakPtrs();
1230 } 1224 }
1231 1225
1232 } // namespace internal 1226 } // namespace internal
1233 1227
1234 } // namespace net 1228 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_handle.cc ('k') | net/socket/nss_ssl_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698