| 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 "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 22 matching lines...) Expand all Loading... |
| 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_NotifyStartOpeningHandshake::ID: | 40 case WebSocketMsg_NotifyStartOpeningHandshake::ID: |
| 41 case WebSocketMsg_NotifyFinishOpeningHandshake::ID: | 41 case WebSocketMsg_NotifyFinishOpeningHandshake::ID: |
| 42 case WebSocketMsg_NotifyFailure::ID: | 42 case WebSocketMsg_NotifyFailure::ID: |
| 43 case WebSocketMsg_BlobSendComplete::ID: |
| 43 case WebSocketMsg_SendFrame::ID: | 44 case WebSocketMsg_SendFrame::ID: |
| 44 case WebSocketMsg_FlowControl::ID: | 45 case WebSocketMsg_FlowControl::ID: |
| 45 case WebSocketMsg_DropChannel::ID: | 46 case WebSocketMsg_DropChannel::ID: |
| 46 case WebSocketMsg_NotifyClosing::ID: | 47 case WebSocketMsg_NotifyClosing::ID: |
| 47 break; | 48 break; |
| 48 default: | 49 default: |
| 49 return false; | 50 return false; |
| 50 } | 51 } |
| 51 | 52 |
| 52 WebSocketBridge* bridge = GetBridge(msg.routing_id(), msg.type()); | 53 WebSocketBridge* bridge = GetBridge(msg.routing_id(), msg.type()); |
| 53 if (!bridge) | 54 if (!bridge) |
| 54 return true; | 55 return true; |
| 55 return bridge->OnMessageReceived(msg); | 56 return bridge->OnMessageReceived(msg); |
| 56 } | 57 } |
| 57 | 58 |
| 58 WebSocketBridge* WebSocketDispatcher::GetBridge(int channel_id, uint32_t type) { | 59 WebSocketBridge* WebSocketDispatcher::GetBridge(int channel_id, uint32_t type) { |
| 59 std::map<int, WebSocketBridge*>::iterator iter = bridges_.find(channel_id); | 60 std::map<int, WebSocketBridge*>::iterator iter = bridges_.find(channel_id); |
| 60 if (iter == bridges_.end()) { | 61 if (iter == bridges_.end()) { |
| 61 DVLOG(1) << "No bridge for channel_id=" << channel_id | 62 DVLOG(1) << "No bridge for channel_id=" << channel_id |
| 62 << ", type=" << type; | 63 << ", type=" << type; |
| 63 return NULL; | 64 return NULL; |
| 64 } | 65 } |
| 65 return iter->second; | 66 return iter->second; |
| 66 } | 67 } |
| 67 | 68 |
| 68 } // namespace content | 69 } // namespace content |
| OLD | NEW |