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

Side by Side Diff: content/browser/renderer_host/websocket_host.cc

Issue 390773002: [WebSocket] Send a close frame when the renderer process is gone. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/websocket_host.h ('k') | net/data/websocket/README » ('j') | 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/browser/renderer_host/websocket_host.h" 5 #include "content/browser/renderer_host/websocket_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "content/browser/renderer_host/websocket_dispatcher_host.h" 10 #include "content/browser/renderer_host/websocket_dispatcher_host.h"
11 #include "content/browser/ssl/ssl_error_handler.h" 11 #include "content/browser/ssl/ssl_error_handler.h"
12 #include "content/browser/ssl/ssl_manager.h" 12 #include "content/browser/ssl/ssl_manager.h"
13 #include "content/common/websocket_messages.h" 13 #include "content/common/websocket_messages.h"
14 #include "ipc/ipc_message_macros.h" 14 #include "ipc/ipc_message_macros.h"
15 #include "net/http/http_request_headers.h" 15 #include "net/http/http_request_headers.h"
16 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
17 #include "net/http/http_util.h" 17 #include "net/http/http_util.h"
18 #include "net/ssl/ssl_info.h" 18 #include "net/ssl/ssl_info.h"
19 #include "net/websockets/websocket_channel.h" 19 #include "net/websockets/websocket_channel.h"
20 #include "net/websockets/websocket_errors.h"
20 #include "net/websockets/websocket_event_interface.h" 21 #include "net/websockets/websocket_event_interface.h"
21 #include "net/websockets/websocket_frame.h" // for WebSocketFrameHeader::OpCode 22 #include "net/websockets/websocket_frame.h" // for WebSocketFrameHeader::OpCode
22 #include "net/websockets/websocket_handshake_request_info.h" 23 #include "net/websockets/websocket_handshake_request_info.h"
23 #include "net/websockets/websocket_handshake_response_info.h" 24 #include "net/websockets/websocket_handshake_response_info.h"
24 #include "url/origin.h" 25 #include "url/origin.h"
25 26
26 namespace content { 27 namespace content {
27 28
28 namespace { 29 namespace {
29 30
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 WebSocketDispatcherHost* dispatcher, 324 WebSocketDispatcherHost* dispatcher,
324 net::URLRequestContext* url_request_context) 325 net::URLRequestContext* url_request_context)
325 : dispatcher_(dispatcher), 326 : dispatcher_(dispatcher),
326 url_request_context_(url_request_context), 327 url_request_context_(url_request_context),
327 routing_id_(routing_id) { 328 routing_id_(routing_id) {
328 DVLOG(1) << "WebSocketHost: created routing_id=" << routing_id; 329 DVLOG(1) << "WebSocketHost: created routing_id=" << routing_id;
329 } 330 }
330 331
331 WebSocketHost::~WebSocketHost() {} 332 WebSocketHost::~WebSocketHost() {}
332 333
334 void WebSocketHost::GoAway() {
335 OnDropChannel(false, static_cast<uint16>(net::kWebSocketErrorGoingAway), "");
336 }
337
333 bool WebSocketHost::OnMessageReceived(const IPC::Message& message) { 338 bool WebSocketHost::OnMessageReceived(const IPC::Message& message) {
334 bool handled = true; 339 bool handled = true;
335 IPC_BEGIN_MESSAGE_MAP(WebSocketHost, message) 340 IPC_BEGIN_MESSAGE_MAP(WebSocketHost, message)
336 IPC_MESSAGE_HANDLER(WebSocketHostMsg_AddChannelRequest, OnAddChannelRequest) 341 IPC_MESSAGE_HANDLER(WebSocketHostMsg_AddChannelRequest, OnAddChannelRequest)
337 IPC_MESSAGE_HANDLER(WebSocketMsg_SendFrame, OnSendFrame) 342 IPC_MESSAGE_HANDLER(WebSocketMsg_SendFrame, OnSendFrame)
338 IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, OnFlowControl) 343 IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, OnFlowControl)
339 IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, OnDropChannel) 344 IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, OnDropChannel)
340 IPC_MESSAGE_UNHANDLED(handled = false) 345 IPC_MESSAGE_UNHANDLED(handled = false)
341 IPC_END_MESSAGE_MAP() 346 IPC_END_MESSAGE_MAP()
342 return handled; 347 return handled;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 DVLOG(3) << "WebSocketHost::OnDropChannel" 391 DVLOG(3) << "WebSocketHost::OnDropChannel"
387 << " routing_id=" << routing_id_ << " was_clean=" << was_clean 392 << " routing_id=" << routing_id_ << " was_clean=" << was_clean
388 << " code=" << code << " reason=\"" << reason << "\""; 393 << " code=" << code << " reason=\"" << reason << "\"";
389 394
390 DCHECK(channel_); 395 DCHECK(channel_);
391 // TODO(yhirano): Handle |was_clean| appropriately. 396 // TODO(yhirano): Handle |was_clean| appropriately.
392 channel_->StartClosingHandshake(code, reason); 397 channel_->StartClosingHandshake(code, reason);
393 } 398 }
394 399
395 } // namespace content 400 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/websocket_host.h ('k') | net/data/websocket/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698