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

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

Issue 165217: Revert 22811 - 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
Reverse-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 if (group.IsEmpty()) { 133 } else {
134 group_map_.erase(group_name); 134 if (group.IsEmpty())
135 group_map_.erase(group_name);
135 } 136 }
136 137
137 return rv; 138 return rv;
138 } 139 }
139 140
140 void ClientSocketPoolBase::CancelRequest(const std::string& group_name, 141 void ClientSocketPoolBase::CancelRequest(const std::string& group_name,
141 const ClientSocketHandle* handle) { 142 const ClientSocketHandle* handle) {
142 CHECK(ContainsKey(group_map_, group_name)); 143 CHECK(ContainsKey(group_map_, group_name));
143 144
144 Group& group = group_map_[group_name]; 145 Group& group = group_map_[group_name];
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 delete j->socket; 258 delete j->socket;
258 j = group.idle_sockets.erase(j); 259 j = group.idle_sockets.erase(j);
259 DecrementIdleCount(); 260 DecrementIdleCount();
260 } else { 261 } else {
261 ++j; 262 ++j;
262 } 263 }
263 } 264 }
264 265
265 // Delete group if no longer needed. 266 // Delete group if no longer needed.
266 if (group.IsEmpty()) { 267 if (group.IsEmpty()) {
268 CHECK(group.pending_requests.empty());
267 group_map_.erase(i++); 269 group_map_.erase(i++);
268 } else { 270 } else {
269 ++i; 271 ++i;
270 } 272 }
271 } 273 }
272 } 274 }
273 275
274 void ClientSocketPoolBase::IncrementIdleCount() { 276 void ClientSocketPoolBase::IncrementIdleCount() {
275 if (++idle_socket_count_ == 1) 277 if (++idle_socket_count_ == 1)
276 timer_.Start(TimeDelta::FromSeconds(kCleanupInterval), this, 278 timer_.Start(TimeDelta::FromSeconds(kCleanupInterval), this,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 IncrementIdleCount(); 450 IncrementIdleCount();
449 } 451 }
450 452
451 void ClientSocketPoolBase::CancelAllConnectJobs() { 453 void ClientSocketPoolBase::CancelAllConnectJobs() {
452 for (GroupMap::iterator i = group_map_.begin(); i != group_map_.end();) { 454 for (GroupMap::iterator i = group_map_.begin(); i != group_map_.end();) {
453 Group& group = i->second; 455 Group& group = i->second;
454 STLDeleteElements(&group.jobs); 456 STLDeleteElements(&group.jobs);
455 457
456 // Delete group if no longer needed. 458 // Delete group if no longer needed.
457 if (group.IsEmpty()) { 459 if (group.IsEmpty()) {
460 CHECK(group.pending_requests.empty());
458 group_map_.erase(i++); 461 group_map_.erase(i++);
459 } else { 462 } else {
460 ++i; 463 ++i;
461 } 464 }
462 } 465 }
463 } 466 }
464 467
465 } // namespace net 468 } // 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