| 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/browser/renderer_host/websocket_dispatcher_host.h" | 5 #include "content/browser/renderer_host/websocket_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 void WebSocketDispatcherHost::SendFlowControl(int routing_id, int64 quota) { | 102 void WebSocketDispatcherHost::SendFlowControl(int routing_id, int64 quota) { |
| 103 SendOrDrop(new WebSocketMsg_FlowControl(routing_id, quota)); | 103 SendOrDrop(new WebSocketMsg_FlowControl(routing_id, quota)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void WebSocketDispatcherHost::SendClosing(int routing_id) { | 106 void WebSocketDispatcherHost::SendClosing(int routing_id) { |
| 107 // TODO(ricea): Implement the SendClosing IPC. | 107 // TODO(ricea): Implement the SendClosing IPC. |
| 108 } | 108 } |
| 109 | 109 |
| 110 void WebSocketDispatcherHost::DoDropChannel(int routing_id, | 110 void WebSocketDispatcherHost::DoDropChannel(int routing_id, |
| 111 bool fail, |
| 111 uint16 code, | 112 uint16 code, |
| 112 const std::string& reason) { | 113 const std::string& reason) { |
| 113 SendOrDrop(new WebSocketMsg_DropChannel(routing_id, code, reason)); | 114 SendOrDrop(new WebSocketMsg_DropChannel(routing_id, fail, code, reason)); |
| 114 DeleteWebSocketHost(routing_id); | 115 DeleteWebSocketHost(routing_id); |
| 115 } | 116 } |
| 116 | 117 |
| 117 WebSocketDispatcherHost::~WebSocketDispatcherHost() { | 118 WebSocketDispatcherHost::~WebSocketDispatcherHost() { |
| 118 STLDeleteContainerPairSecondPointers(hosts_.begin(), hosts_.end()); | 119 STLDeleteContainerPairSecondPointers(hosts_.begin(), hosts_.end()); |
| 119 } | 120 } |
| 120 | 121 |
| 121 void WebSocketDispatcherHost::DeleteWebSocketHost(int routing_id) { | 122 void WebSocketDispatcherHost::DeleteWebSocketHost(int routing_id) { |
| 122 WebSocketHostTable::iterator it = hosts_.find(routing_id); | 123 WebSocketHostTable::iterator it = hosts_.find(routing_id); |
| 123 if (it != hosts_.end()) { | 124 if (it != hosts_.end()) { |
| 124 delete it->second; | 125 delete it->second; |
| 125 hosts_.erase(it); | 126 hosts_.erase(it); |
| 126 } | 127 } |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace content | 130 } // namespace content |
| OLD | NEW |