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

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

Issue 2276433003: Remove a Platform::current() check from Mojo's error handler in WebSocket (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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()) {
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
171 // Our connection to the WebSocket was dropped. This could be due to 162 // Our connection to the WebSocket was dropped. This could be due to
172 // exceeding the maximum number of concurrent websockets from this process. 163 // exceeding the maximum number of concurrent websockets from this process.
173 164
174 // TODO(darin): This error message is overly specific. We don't know for sure 165 // TODO(darin): This error message is overly specific. We don't know for sure
175 // that this is the only reason we'd get here. This should be more generic or 166 // that this is the only reason we'd get here. This should be more generic or
176 // we should figure out how to make it more specific. 167 // we should figure out how to make it more specific.
177 OnFailChannel("Error in connection establishment: " 168 OnFailChannel("Error in connection establishment: "
178 "net::ERR_INSUFFICIENT_RESOURCES"); 169 "net::ERR_INSUFFICIENT_RESOURCES");
179 } 170 }
180 171
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 DVLOG(1) << "WebSocketHandleImpl @" << reinterpret_cast<void*>(this) 290 DVLOG(1) << "WebSocketHandleImpl @" << reinterpret_cast<void*>(this)
300 << " OnClosingHandshake()"; 291 << " OnClosingHandshake()";
301 if (!client_) 292 if (!client_)
302 return; 293 return;
303 294
304 client_->didStartClosingHandshake(this); 295 client_->didStartClosingHandshake(this);
305 // |this| can be deleted here. 296 // |this| can be deleted here.
306 } 297 }
307 298
308 } // namespace content 299 } // 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