| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 WebSocketHostState WebSocketDispatcherHost::SendClosing(int routing_id) { | 124 WebSocketHostState WebSocketDispatcherHost::SendClosing(int routing_id) { |
| 125 // TODO(ricea): Implement the SendClosing IPC. | 125 // TODO(ricea): Implement the SendClosing IPC. |
| 126 return WEBSOCKET_HOST_ALIVE; | 126 return WEBSOCKET_HOST_ALIVE; |
| 127 } | 127 } |
| 128 | 128 |
| 129 WebSocketHostState WebSocketDispatcherHost::DoDropChannel( | 129 WebSocketHostState WebSocketDispatcherHost::DoDropChannel( |
| 130 int routing_id, | 130 int routing_id, |
| 131 uint16 code, | 131 uint16 code, |
| 132 const std::string& reason) { | 132 const std::string& reason) { |
| 133 if (SendOrDrop(new WebSocketMsg_DropChannel(routing_id, code, reason)) == | 133 bool was_clean = true; |
| 134 if (SendOrDrop( |
| 135 new WebSocketMsg_DropChannel(routing_id, was_clean, code, reason)) == |
| 134 WEBSOCKET_HOST_DELETED) | 136 WEBSOCKET_HOST_DELETED) |
| 135 return WEBSOCKET_HOST_DELETED; | 137 return WEBSOCKET_HOST_DELETED; |
| 136 DeleteWebSocketHost(routing_id); | 138 DeleteWebSocketHost(routing_id); |
| 137 return WEBSOCKET_HOST_DELETED; | 139 return WEBSOCKET_HOST_DELETED; |
| 138 } | 140 } |
| 139 | 141 |
| 140 WebSocketDispatcherHost::~WebSocketDispatcherHost() { | 142 WebSocketDispatcherHost::~WebSocketDispatcherHost() { |
| 141 STLDeleteContainerPairSecondPointers(hosts_.begin(), hosts_.end()); | 143 STLDeleteContainerPairSecondPointers(hosts_.begin(), hosts_.end()); |
| 142 } | 144 } |
| 143 | 145 |
| 144 void WebSocketDispatcherHost::DeleteWebSocketHost(int routing_id) { | 146 void WebSocketDispatcherHost::DeleteWebSocketHost(int routing_id) { |
| 145 WebSocketHostTable::iterator it = hosts_.find(routing_id); | 147 WebSocketHostTable::iterator it = hosts_.find(routing_id); |
| 146 DCHECK(it != hosts_.end()); | 148 DCHECK(it != hosts_.end()); |
| 147 delete it->second; | 149 delete it->second; |
| 148 hosts_.erase(it); | 150 hosts_.erase(it); |
| 149 } | 151 } |
| 150 | 152 |
| 151 } // namespace content | 153 } // namespace content |
| OLD | NEW |