| 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/websockets/websocket_manager.h" | 5 #include "content/browser/websockets/websocket_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 base::Unretained(this))); | 108 base::Unretained(this))); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 WebSocketManager::~WebSocketManager() { | 112 WebSocketManager::~WebSocketManager() { |
| 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 114 | 114 |
| 115 if (!context_destroyed_ && url_request_context_getter_) | 115 if (!context_destroyed_ && url_request_context_getter_) |
| 116 url_request_context_getter_->RemoveObserver(this); | 116 url_request_context_getter_->RemoveObserver(this); |
| 117 | 117 |
| 118 for (auto impl : impls_) { | 118 for (auto* impl : impls_) { |
| 119 impl->GoAway(); | 119 impl->GoAway(); |
| 120 delete impl; | 120 delete impl; |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 void WebSocketManager::DoCreateWebSocket( | 124 void WebSocketManager::DoCreateWebSocket( |
| 125 int frame_id, | 125 int frame_id, |
| 126 blink::mojom::WebSocketRequest request) { | 126 blink::mojom::WebSocketRequest request) { |
| 127 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 127 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 128 | 128 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 ++num_current_failed_connections_; | 218 ++num_current_failed_connections_; |
| 219 } | 219 } |
| 220 impl->GoAway(); | 220 impl->GoAway(); |
| 221 impls_.erase(impl); | 221 impls_.erase(impl); |
| 222 delete impl; | 222 delete impl; |
| 223 } | 223 } |
| 224 | 224 |
| 225 void WebSocketManager::OnContextShuttingDown() { | 225 void WebSocketManager::OnContextShuttingDown() { |
| 226 context_destroyed_ = true; | 226 context_destroyed_ = true; |
| 227 url_request_context_getter_ = nullptr; | 227 url_request_context_getter_ = nullptr; |
| 228 for (const auto& impl : impls_) { | 228 for (auto* impl : impls_) { |
| 229 impl->GoAway(); | 229 impl->GoAway(); |
| 230 delete impl; | 230 delete impl; |
| 231 } | 231 } |
| 232 impls_.clear(); | 232 impls_.clear(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void WebSocketManager::ObserveURLRequestContextGetter() { | 235 void WebSocketManager::ObserveURLRequestContextGetter() { |
| 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 237 if (!url_request_context_getter_->GetURLRequestContext()) { | 237 if (!url_request_context_getter_->GetURLRequestContext()) { |
| 238 context_destroyed_ = true; | 238 context_destroyed_ = true; |
| 239 url_request_context_getter_ = nullptr; | 239 url_request_context_getter_ = nullptr; |
| 240 return; | 240 return; |
| 241 } | 241 } |
| 242 url_request_context_getter_->AddObserver(this); | 242 url_request_context_getter_->AddObserver(this); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // namespace content | 245 } // namespace content |
| OLD | NEW |