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

Side by Side Diff: content/child/websocket_dispatcher.cc

Issue 34753008: Notify WebSocket connection failure, chromium side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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
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/child/websocket_dispatcher.h" 5 #include "content/child/websocket_dispatcher.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <map> 8 #include <map>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 19 matching lines...) Expand all
30 if (iter == bridges_.end()) { 30 if (iter == bridges_.end()) {
31 DVLOG(1) << "Remove a non-existent bridge(" << channel_id << ")"; 31 DVLOG(1) << "Remove a non-existent bridge(" << channel_id << ")";
32 return; 32 return;
33 } 33 }
34 bridges_.erase(iter); 34 bridges_.erase(iter);
35 } 35 }
36 36
37 bool WebSocketDispatcher::OnMessageReceived(const IPC::Message& msg) { 37 bool WebSocketDispatcher::OnMessageReceived(const IPC::Message& msg) {
38 switch (msg.type()) { 38 switch (msg.type()) {
39 case WebSocketMsg_AddChannelResponse::ID: 39 case WebSocketMsg_AddChannelResponse::ID:
40 case WebSocketMsg_NotifyFailure::ID:
40 case WebSocketMsg_SendFrame::ID: 41 case WebSocketMsg_SendFrame::ID:
41 case WebSocketMsg_FlowControl::ID: 42 case WebSocketMsg_FlowControl::ID:
42 case WebSocketMsg_DropChannel::ID: 43 case WebSocketMsg_DropChannel::ID:
43 break; 44 break;
44 default: 45 default:
45 return false; 46 return false;
46 } 47 }
47 48
48 WebSocketBridge* bridge = GetBridge(msg.routing_id(), msg.type()); 49 WebSocketBridge* bridge = GetBridge(msg.routing_id(), msg.type());
49 if (!bridge) 50 if (!bridge)
50 return true; 51 return true;
51 return bridge->OnMessageReceived(msg); 52 return bridge->OnMessageReceived(msg);
52 } 53 }
53 54
54 WebSocketBridge* WebSocketDispatcher::GetBridge(int channel_id, uint32 type) { 55 WebSocketBridge* WebSocketDispatcher::GetBridge(int channel_id, uint32 type) {
55 std::map<int, WebSocketBridge*>::iterator iter = bridges_.find(channel_id); 56 std::map<int, WebSocketBridge*>::iterator iter = bridges_.find(channel_id);
56 if (iter == bridges_.end()) { 57 if (iter == bridges_.end()) {
57 DVLOG(1) << "No bridge for channel_id=" << channel_id 58 DVLOG(1) << "No bridge for channel_id=" << channel_id
58 << ", type=" << type; 59 << ", type=" << type;
59 return NULL; 60 return NULL;
60 } 61 }
61 return iter->second; 62 return iter->second;
62 } 63 }
63 64
64 } // namespace content 65 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698