OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/metrics/stats_counters.h" | 10 #include "base/metrics/stats_counters.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 max_sockets_per_group_(max_sockets_per_group), | 156 max_sockets_per_group_(max_sockets_per_group), |
157 unused_idle_socket_timeout_(unused_idle_socket_timeout), | 157 unused_idle_socket_timeout_(unused_idle_socket_timeout), |
158 used_idle_socket_timeout_(used_idle_socket_timeout), | 158 used_idle_socket_timeout_(used_idle_socket_timeout), |
159 connect_job_factory_(connect_job_factory), | 159 connect_job_factory_(connect_job_factory), |
160 connect_backup_jobs_enabled_(false), | 160 connect_backup_jobs_enabled_(false), |
161 pool_generation_number_(0), | 161 pool_generation_number_(0), |
162 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 162 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
163 DCHECK_LE(0, max_sockets_per_group); | 163 DCHECK_LE(0, max_sockets_per_group); |
164 DCHECK_LE(max_sockets_per_group, max_sockets); | 164 DCHECK_LE(max_sockets_per_group, max_sockets); |
165 | 165 |
166 NetworkChangeNotifier::AddObserver(this); | 166 NetworkChangeNotifier::AddIPAddressObserver(this); |
167 } | 167 } |
168 | 168 |
169 ClientSocketPoolBaseHelper::~ClientSocketPoolBaseHelper() { | 169 ClientSocketPoolBaseHelper::~ClientSocketPoolBaseHelper() { |
170 // Clean up any idle sockets and pending connect jobs. Assert that we have no | 170 // Clean up any idle sockets and pending connect jobs. Assert that we have no |
171 // remaining active sockets or pending requests. They should have all been | 171 // remaining active sockets or pending requests. They should have all been |
172 // cleaned up prior to |this| being destroyed. | 172 // cleaned up prior to |this| being destroyed. |
173 Flush(); | 173 Flush(); |
174 DCHECK(group_map_.empty()); | 174 DCHECK(group_map_.empty()); |
175 DCHECK(pending_callback_map_.empty()); | 175 DCHECK(pending_callback_map_.empty()); |
176 DCHECK_EQ(0, connecting_socket_count_); | 176 DCHECK_EQ(0, connecting_socket_count_); |
177 | 177 |
178 NetworkChangeNotifier::RemoveObserver(this); | 178 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
179 } | 179 } |
180 | 180 |
181 // InsertRequestIntoQueue inserts the request into the queue based on | 181 // InsertRequestIntoQueue inserts the request into the queue based on |
182 // priority. Highest priorities are closest to the front. Older requests are | 182 // priority. Highest priorities are closest to the front. Older requests are |
183 // prioritized over requests of equal priority. | 183 // prioritized over requests of equal priority. |
184 // | 184 // |
185 // static | 185 // static |
186 void ClientSocketPoolBaseHelper::InsertRequestIntoQueue( | 186 void ClientSocketPoolBaseHelper::InsertRequestIntoQueue( |
187 const Request* r, RequestQueue* pending_requests) { | 187 const Request* r, RequestQueue* pending_requests) { |
188 RequestQueue::iterator it = pending_requests->begin(); | 188 RequestQueue::iterator it = pending_requests->begin(); |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 // Delete active jobs. | 1073 // Delete active jobs. |
1074 STLDeleteElements(&jobs_); | 1074 STLDeleteElements(&jobs_); |
1075 | 1075 |
1076 // Cancel pending backup job. | 1076 // Cancel pending backup job. |
1077 method_factory_.RevokeAll(); | 1077 method_factory_.RevokeAll(); |
1078 } | 1078 } |
1079 | 1079 |
1080 } // namespace internal | 1080 } // namespace internal |
1081 | 1081 |
1082 } // namespace net | 1082 } // namespace net |
OLD | NEW |