Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: content/renderer/websockethandle_impl.cc

Issue 2258003003: [WebSocket] Ignore connection errors in the shutdown sequence (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/renderer/websockethandle_impl.h" 5 #include "content/renderer/websockethandle_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (websocket_) 152 if (websocket_)
153 websocket_->StartClosingHandshake(kAbnormalShutdownOpCode, std::string()); 153 websocket_->StartClosingHandshake(kAbnormalShutdownOpCode, std::string());
154 } 154 }
155 155
156 void WebSocketHandleImpl::Disconnect() { 156 void WebSocketHandleImpl::Disconnect() {
157 websocket_.reset(); 157 websocket_.reset();
158 client_ = nullptr; 158 client_ = nullptr;
159 } 159 }
160 160
161 void WebSocketHandleImpl::OnConnectionError() { 161 void WebSocketHandleImpl::OnConnectionError() {
162 if (!blink::Platform::current()) {
darin (slow to review) 2016/08/19 15:54:16 This seems like a sensible band-aid.
163 // In the renderrer shutdown sequence, mojo channels are destructed and this
164 // function is called. On the other hand, blink objects became invalid
165 // *silently*, which means we must not touch |*client_| any more.
166 // TODO(yhirano): Remove this code once the shutdown sequence is fixed.
167 Disconnect();
168 return;
169 }
170
162 // Our connection to the WebSocket was dropped. This could be due to 171 // Our connection to the WebSocket was dropped. This could be due to
163 // exceeding the maximum number of concurrent websockets from this process. 172 // exceeding the maximum number of concurrent websockets from this process.
164 173
165 // TODO(darin): This error message is overly specific. We don't know for sure 174 // TODO(darin): This error message is overly specific. We don't know for sure
166 // that this is the only reason we'd get here. This should be more generic or 175 // that this is the only reason we'd get here. This should be more generic or
167 // we should figure out how to make it more specific. 176 // we should figure out how to make it more specific.
168 OnFailChannel("Error in connection establishment: " 177 OnFailChannel("Error in connection establishment: "
169 "net::ERR_INSUFFICIENT_RESOURCES"); 178 "net::ERR_INSUFFICIENT_RESOURCES");
170 } 179 }
171 180
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 DVLOG(1) << "WebSocketHandleImpl @" << reinterpret_cast<void*>(this) 299 DVLOG(1) << "WebSocketHandleImpl @" << reinterpret_cast<void*>(this)
291 << " OnClosingHandshake()"; 300 << " OnClosingHandshake()";
292 if (!client_) 301 if (!client_)
293 return; 302 return;
294 303
295 client_->didStartClosingHandshake(this); 304 client_->didStartClosingHandshake(this);
296 // |this| can be deleted here. 305 // |this| can be deleted here.
297 } 306 }
298 307
299 } // namespace content 308 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698