OLD | NEW |
---|---|
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 // cleaned up prior to |this| being destroyed. | 191 // cleaned up prior to |this| being destroyed. |
192 Flush(); | 192 Flush(); |
193 DCHECK(group_map_.empty()); | 193 DCHECK(group_map_.empty()); |
194 DCHECK(pending_callback_map_.empty()); | 194 DCHECK(pending_callback_map_.empty()); |
195 DCHECK_EQ(0, connecting_socket_count_); | 195 DCHECK_EQ(0, connecting_socket_count_); |
196 CHECK(higher_layer_pools_.empty()); | 196 CHECK(higher_layer_pools_.empty()); |
197 | 197 |
198 NetworkChangeNotifier::RemoveIPAddressObserver(this); | 198 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
199 } | 199 } |
200 | 200 |
201 ClientSocketPoolBaseHelper::CallbackResultPair::CallbackResultPair() | |
202 : result(OK) { | |
203 } | |
204 | |
205 ClientSocketPoolBaseHelper::CallbackResultPair::CallbackResultPair( | |
206 const CompletionCallback& callback_in, int result_in) | |
207 : callback(callback_in), | |
208 result(result_in) { | |
209 } | |
210 | |
201 ClientSocketPoolBaseHelper::CallbackResultPair::~CallbackResultPair() {} | 211 ClientSocketPoolBaseHelper::CallbackResultPair::~CallbackResultPair() {} |
202 | 212 |
203 // InsertRequestIntoQueue inserts the request into the queue based on | 213 // InsertRequestIntoQueue inserts the request into the queue based on |
204 // priority. Highest priorities are closest to the front. Older requests are | 214 // priority. Highest priorities are closest to the front. Older requests are |
205 // prioritized over requests of equal priority. | 215 // prioritized over requests of equal priority. |
206 // | 216 // |
207 // static | 217 // static |
208 void ClientSocketPoolBaseHelper::InsertRequestIntoQueue( | 218 void ClientSocketPoolBaseHelper::InsertRequestIntoQueue( |
209 const Request* r, RequestQueue* pending_requests) { | 219 const Request* r, RequestQueue* pending_requests) { |
210 RequestQueue::iterator it = pending_requests->begin(); | 220 RequestQueue::iterator it = pending_requests->begin(); |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1205 pool->connecting_socket_count_++; | 1215 pool->connecting_socket_count_++; |
1206 AddJob(backup_job, false); | 1216 AddJob(backup_job, false); |
1207 if (rv != ERR_IO_PENDING) | 1217 if (rv != ERR_IO_PENDING) |
1208 pool->OnConnectJobComplete(rv, backup_job); | 1218 pool->OnConnectJobComplete(rv, backup_job); |
1209 } | 1219 } |
1210 | 1220 |
1211 void ClientSocketPoolBaseHelper::Group::SanityCheck() { | 1221 void ClientSocketPoolBaseHelper::Group::SanityCheck() { |
1212 DCHECK_LE(unassigned_job_count_, jobs_.size()); | 1222 DCHECK_LE(unassigned_job_count_, jobs_.size()); |
1213 } | 1223 } |
1214 | 1224 |
1225 | |
mmenke
2012/08/09 15:13:35
Remove extra line breaks.
hans
2012/08/09 15:35:42
Done.
| |
1226 | |
1215 void ClientSocketPoolBaseHelper::Group::RemoveAllJobs() { | 1227 void ClientSocketPoolBaseHelper::Group::RemoveAllJobs() { |
1216 SanityCheck(); | 1228 SanityCheck(); |
1217 | 1229 |
1218 // Delete active jobs. | 1230 // Delete active jobs. |
1219 STLDeleteElements(&jobs_); | 1231 STLDeleteElements(&jobs_); |
1220 unassigned_job_count_ = 0; | 1232 unassigned_job_count_ = 0; |
1221 | 1233 |
1222 // Cancel pending backup job. | 1234 // Cancel pending backup job. |
1223 weak_factory_.InvalidateWeakPtrs(); | 1235 weak_factory_.InvalidateWeakPtrs(); |
1224 } | 1236 } |
1225 | 1237 |
1226 } // namespace internal | 1238 } // namespace internal |
1227 | 1239 |
1228 } // namespace net | 1240 } // namespace net |
OLD | NEW |