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 "modules/websockets/WebSocketHandleImpl.h" | 5 #include "modules/websockets/WebSocketHandleImpl.h" |
6 | 6 |
7 #include "modules/websockets/WebSocketHandleClient.h" | 7 #include "modules/websockets/WebSocketHandleClient.h" |
8 #include "platform/network/NetworkLog.h" | 8 #include "platform/network/NetworkLog.h" |
9 #include "platform/network/WebSocketHandshakeRequest.h" | 9 #include "platform/network/WebSocketHandshakeRequest.h" |
10 #include "platform/network/WebSocketHandshakeResponse.h" | 10 #include "platform/network/WebSocketHandshakeResponse.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 void WebSocketHandleImpl::disconnect() | 119 void WebSocketHandleImpl::disconnect() |
120 { | 120 { |
121 m_websocket.reset(); | 121 m_websocket.reset(); |
122 m_client = nullptr; | 122 m_client = nullptr; |
123 } | 123 } |
124 | 124 |
125 void WebSocketHandleImpl::onConnectionError() | 125 void WebSocketHandleImpl::onConnectionError() |
126 { | 126 { |
| 127 if (!blink::Platform::current()) { |
| 128 // In the renderrer shutdown sequence, mojo channels are destructed and
this |
| 129 // function is called. On the other hand, blink objects became invalid |
| 130 // *silently*, which means we must not touch |*client_| any more. |
| 131 // TODO(yhirano): Remove this code once the shutdown sequence is fixed. |
| 132 disconnect(); |
| 133 return; |
| 134 } |
| 135 |
127 // Our connection to the WebSocket was dropped. This could be due to | 136 // Our connection to the WebSocket was dropped. This could be due to |
128 // exceeding the maximum number of concurrent websockets from this process. | 137 // exceeding the maximum number of concurrent websockets from this process. |
129 | 138 |
130 // TODO(darin): Communicate a more specific error here (see crbug/634502). | 139 // TODO(darin): Communicate a more specific error here (see crbug/634502). |
131 OnFailChannel( | 140 OnFailChannel( |
132 "Error in connection establishment: net:" | 141 "Error in connection establishment: net:" |
133 ":ERR_INSUFFICIENT_RESOURCES"); | 142 ":ERR_INSUFFICIENT_RESOURCES"); |
134 } | 143 } |
135 | 144 |
136 void WebSocketHandleImpl::OnFailChannel(const String& message) | 145 void WebSocketHandleImpl::OnFailChannel(const String& message) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 { | 244 { |
236 NETWORK_DVLOG(1) << this << " OnClosingHandshake()"; | 245 NETWORK_DVLOG(1) << this << " OnClosingHandshake()"; |
237 if (!m_client) | 246 if (!m_client) |
238 return; | 247 return; |
239 | 248 |
240 m_client->didStartClosingHandshake(this); | 249 m_client->didStartClosingHandshake(this); |
241 // |this| can be deleted here. | 250 // |this| can be deleted here. |
242 } | 251 } |
243 | 252 |
244 } // namespace blink | 253 } // namespace blink |
OLD | NEW |