OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/renderer_host/websocket_dispatcher_host.h" | 5 #include "content/browser/renderer_host/websocket_dispatcher_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 hosts.push_back(i->second); | 243 hosts.push_back(i->second); |
244 } | 244 } |
245 | 245 |
246 for (size_t i = 0; i < hosts.size(); ++i) { | 246 for (size_t i = 0; i < hosts.size(); ++i) { |
247 // Note that some calls to GoAway could fail. In that case hosts[i] will be | 247 // Note that some calls to GoAway could fail. In that case hosts[i] will be |
248 // deleted and removed from |hosts_| in |DoDropChannel|. | 248 // deleted and removed from |hosts_| in |DoDropChannel|. |
249 hosts[i]->GoAway(); | 249 hosts[i]->GoAway(); |
250 hosts[i] = NULL; | 250 hosts[i] = NULL; |
251 } | 251 } |
252 | 252 |
253 STLDeleteContainerPairSecondPointers(hosts_.begin(), hosts_.end()); | 253 base::STLDeleteContainerPairSecondPointers(hosts_.begin(), hosts_.end()); |
254 } | 254 } |
255 | 255 |
256 void WebSocketDispatcherHost::DeleteWebSocketHost(int routing_id) { | 256 void WebSocketDispatcherHost::DeleteWebSocketHost(int routing_id) { |
257 WebSocketHostTable::iterator it = hosts_.find(routing_id); | 257 WebSocketHostTable::iterator it = hosts_.find(routing_id); |
258 DCHECK(it != hosts_.end()); | 258 DCHECK(it != hosts_.end()); |
259 DCHECK(it->second); | 259 DCHECK(it->second); |
260 if (!it->second->handshake_succeeded()) { | 260 if (!it->second->handshake_succeeded()) { |
261 // Update throttling counters (failure). | 261 // Update throttling counters (failure). |
262 --num_pending_connections_; | 262 --num_pending_connections_; |
263 DCHECK_GE(num_pending_connections_, 0); | 263 DCHECK_GE(num_pending_connections_, 0); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 num_current_succeeded_connections_ = 0; | 301 num_current_succeeded_connections_ = 0; |
302 | 302 |
303 if (num_pending_connections_ == 0 && | 303 if (num_pending_connections_ == 0 && |
304 num_previous_failed_connections_ == 0 && | 304 num_previous_failed_connections_ == 0 && |
305 num_previous_succeeded_connections_ == 0) { | 305 num_previous_succeeded_connections_ == 0) { |
306 throttling_period_timer_.Stop(); | 306 throttling_period_timer_.Stop(); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 } // namespace content | 310 } // namespace content |
OLD | NEW |