| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 48 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, manager_); | 48 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, manager_); |
| 49 manager_ = nullptr; | 49 manager_ = nullptr; |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 WebSocketManager* manager_; | 53 WebSocketManager* manager_; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // static | 56 // static |
| 57 void WebSocketManager::CreateWebSocket(int process_id, int frame_id, | 57 void WebSocketManager::CreateWebSocket( |
| 58 blink::mojom::WebSocketRequest request) { | 58 int process_id, |
| 59 int frame_id, |
| 60 const service_manager::BindSourceInfo& source_info, |
| 61 blink::mojom::WebSocketRequest request) { |
| 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 60 | 63 |
| 61 RenderProcessHost* host = RenderProcessHost::FromID(process_id); | 64 RenderProcessHost* host = RenderProcessHost::FromID(process_id); |
| 62 DCHECK(host); | 65 DCHECK(host); |
| 63 | 66 |
| 64 // Maintain a WebSocketManager per RenderProcessHost. While the instance of | 67 // Maintain a WebSocketManager per RenderProcessHost. While the instance of |
| 65 // WebSocketManager is allocated on the UI thread, it must only be used and | 68 // WebSocketManager is allocated on the UI thread, it must only be used and |
| 66 // deleted from the IO thread. | 69 // deleted from the IO thread. |
| 67 | 70 |
| 68 Handle* handle = | 71 Handle* handle = |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 237 if (!url_request_context_getter_->GetURLRequestContext()) { | 240 if (!url_request_context_getter_->GetURLRequestContext()) { |
| 238 context_destroyed_ = true; | 241 context_destroyed_ = true; |
| 239 url_request_context_getter_ = nullptr; | 242 url_request_context_getter_ = nullptr; |
| 240 return; | 243 return; |
| 241 } | 244 } |
| 242 url_request_context_getter_->AddObserver(this); | 245 url_request_context_getter_->AddObserver(this); |
| 243 } | 246 } |
| 244 | 247 |
| 245 } // namespace content | 248 } // namespace content |
| OLD | NEW |