| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 int routing_id, | 73 int routing_id, |
| 74 base::TimeDelta delay) { | 74 base::TimeDelta delay) { |
| 75 return new WebSocketHost( | 75 return new WebSocketHost( |
| 76 routing_id, this, get_context_callback_.Run(), delay); | 76 routing_id, this, get_context_callback_.Run(), delay); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool WebSocketDispatcherHost::OnMessageReceived(const IPC::Message& message) { | 79 bool WebSocketDispatcherHost::OnMessageReceived(const IPC::Message& message) { |
| 80 switch (message.type()) { | 80 switch (message.type()) { |
| 81 case WebSocketHostMsg_AddChannelRequest::ID: | 81 case WebSocketHostMsg_AddChannelRequest::ID: |
| 82 case WebSocketHostMsg_SendBlob::ID: | 82 case WebSocketHostMsg_SendBlob::ID: |
| 83 case WebSocketHostMsg_BinaryTypeChanged::ID: |
| 84 case WebSocketHostMsg_BlobConfirmed::ID: |
| 83 case WebSocketMsg_SendFrame::ID: | 85 case WebSocketMsg_SendFrame::ID: |
| 84 case WebSocketMsg_FlowControl::ID: | 86 case WebSocketMsg_FlowControl::ID: |
| 85 case WebSocketMsg_DropChannel::ID: | 87 case WebSocketMsg_DropChannel::ID: |
| 86 break; | 88 break; |
| 87 | 89 |
| 88 default: | 90 default: |
| 89 // Every message that has not been handled by a previous filter passes | 91 // Every message that has not been handled by a previous filter passes |
| 90 // through here, so it is good to pass them on as efficiently as possible. | 92 // through here, so it is good to pass them on as efficiently as possible. |
| 91 return false; | 93 return false; |
| 92 } | 94 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 return WEBSOCKET_HOST_DELETED; | 216 return WEBSOCKET_HOST_DELETED; |
| 215 } | 217 } |
| 216 DeleteWebSocketHost(routing_id); | 218 DeleteWebSocketHost(routing_id); |
| 217 return WEBSOCKET_HOST_DELETED; | 219 return WEBSOCKET_HOST_DELETED; |
| 218 } | 220 } |
| 219 | 221 |
| 220 WebSocketHostState WebSocketDispatcherHost::BlobSendComplete(int routing_id) { | 222 WebSocketHostState WebSocketDispatcherHost::BlobSendComplete(int routing_id) { |
| 221 return SendOrDrop(new WebSocketMsg_BlobSendComplete(routing_id)); | 223 return SendOrDrop(new WebSocketMsg_BlobSendComplete(routing_id)); |
| 222 } | 224 } |
| 223 | 225 |
| 226 WebSocketHostState WebSocketDispatcherHost::BlobReceived( |
| 227 int routing_id, |
| 228 const std::string& uuid, |
| 229 uint64_t size) { |
| 230 return SendOrDrop(new WebSocketMsg_BlobReceived(routing_id, uuid, size)); |
| 231 } |
| 232 |
| 224 WebSocketHostState WebSocketDispatcherHost::DoDropChannel( | 233 WebSocketHostState WebSocketDispatcherHost::DoDropChannel( |
| 225 int routing_id, | 234 int routing_id, |
| 226 bool was_clean, | 235 bool was_clean, |
| 227 uint16_t code, | 236 uint16_t code, |
| 228 const std::string& reason) { | 237 const std::string& reason) { |
| 229 if (SendOrDrop( | 238 if (SendOrDrop( |
| 230 new WebSocketMsg_DropChannel(routing_id, was_clean, code, reason)) == | 239 new WebSocketMsg_DropChannel(routing_id, was_clean, code, reason)) == |
| 231 WEBSOCKET_HOST_DELETED) | 240 WEBSOCKET_HOST_DELETED) |
| 232 return WEBSOCKET_HOST_DELETED; | 241 return WEBSOCKET_HOST_DELETED; |
| 233 DeleteWebSocketHost(routing_id); | 242 DeleteWebSocketHost(routing_id); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 num_current_succeeded_connections_ = 0; | 310 num_current_succeeded_connections_ = 0; |
| 302 | 311 |
| 303 if (num_pending_connections_ == 0 && | 312 if (num_pending_connections_ == 0 && |
| 304 num_previous_failed_connections_ == 0 && | 313 num_previous_failed_connections_ == 0 && |
| 305 num_previous_succeeded_connections_ == 0) { | 314 num_previous_succeeded_connections_ == 0) { |
| 306 throttling_period_timer_.Stop(); | 315 throttling_period_timer_.Stop(); |
| 307 } | 316 } |
| 308 } | 317 } |
| 309 | 318 |
| 310 } // namespace content | 319 } // namespace content |
| OLD | NEW |