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

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

Issue 164200: Merge 21988 - Fix crash in client_socket_pool_base.cc.... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 4 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_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')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/net/socket/client_socket_pool_base.cc:r21988
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/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ConnectJob* job = connect_job.release(); 123 ConnectJob* job = connect_job.release();
124 if (g_late_binding) { 124 if (g_late_binding) {
125 CHECK(!ContainsKey(connect_job_map_, handle)); 125 CHECK(!ContainsKey(connect_job_map_, handle));
126 InsertRequestIntoQueue(r, &group.pending_requests); 126 InsertRequestIntoQueue(r, &group.pending_requests);
127 } else { 127 } else {
128 group.connecting_requests[handle] = r; 128 group.connecting_requests[handle] = r;
129 CHECK(!ContainsKey(connect_job_map_, handle)); 129 CHECK(!ContainsKey(connect_job_map_, handle));
130 connect_job_map_[handle] = job; 130 connect_job_map_[handle] = job;
131 } 131 }
132 group.jobs.insert(job); 132 group.jobs.insert(job);
133 } else { 133 } else if (group.IsEmpty()) {
134 if (group.IsEmpty()) 134 group_map_.erase(group_name);
135 group_map_.erase(group_name);
136 } 135 }
137 136
138 return rv; 137 return rv;
139 } 138 }
140 139
141 void ClientSocketPoolBase::CancelRequest(const std::string& group_name, 140 void ClientSocketPoolBase::CancelRequest(const std::string& group_name,
142 const ClientSocketHandle* handle) { 141 const ClientSocketHandle* handle) {
143 CHECK(ContainsKey(group_map_, group_name)); 142 CHECK(ContainsKey(group_map_, group_name));
144 143
145 Group& group = group_map_[group_name]; 144 Group& group = group_map_[group_name];
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 delete j->socket; 257 delete j->socket;
259 j = group.idle_sockets.erase(j); 258 j = group.idle_sockets.erase(j);
260 DecrementIdleCount(); 259 DecrementIdleCount();
261 } else { 260 } else {
262 ++j; 261 ++j;
263 } 262 }
264 } 263 }
265 264
266 // Delete group if no longer needed. 265 // Delete group if no longer needed.
267 if (group.IsEmpty()) { 266 if (group.IsEmpty()) {
268 CHECK(group.pending_requests.empty());
269 group_map_.erase(i++); 267 group_map_.erase(i++);
270 } else { 268 } else {
271 ++i; 269 ++i;
272 } 270 }
273 } 271 }
274 } 272 }
275 273
276 void ClientSocketPoolBase::IncrementIdleCount() { 274 void ClientSocketPoolBase::IncrementIdleCount() {
277 if (++idle_socket_count_ == 1) 275 if (++idle_socket_count_ == 1)
278 timer_.Start(TimeDelta::FromSeconds(kCleanupInterval), this, 276 timer_.Start(TimeDelta::FromSeconds(kCleanupInterval), this,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 IncrementIdleCount(); 448 IncrementIdleCount();
451 } 449 }
452 450
453 void ClientSocketPoolBase::CancelAllConnectJobs() { 451 void ClientSocketPoolBase::CancelAllConnectJobs() {
454 for (GroupMap::iterator i = group_map_.begin(); i != group_map_.end();) { 452 for (GroupMap::iterator i = group_map_.begin(); i != group_map_.end();) {
455 Group& group = i->second; 453 Group& group = i->second;
456 STLDeleteElements(&group.jobs); 454 STLDeleteElements(&group.jobs);
457 455
458 // Delete group if no longer needed. 456 // Delete group if no longer needed.
459 if (group.IsEmpty()) { 457 if (group.IsEmpty()) {
460 CHECK(group.pending_requests.empty());
461 group_map_.erase(i++); 458 group_map_.erase(i++);
462 } else { 459 } else {
463 ++i; 460 ++i;
464 } 461 }
465 } 462 }
466 } 463 }
467 464
468 } // namespace net 465 } // 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