| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/socket_stream_dispatcher_host.h" | 5 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/browser/renderer_host/socket_stream_host.h" | 10 #include "content/browser/renderer_host/socket_stream_host.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 ResourceContext* resource_context) | 34 ResourceContext* resource_context) |
| 35 : BrowserMessageFilter(SocketStreamMsgStart), | 35 : BrowserMessageFilter(SocketStreamMsgStart), |
| 36 render_process_id_(render_process_id), | 36 render_process_id_(render_process_id), |
| 37 request_context_callback_(request_context_callback), | 37 request_context_callback_(request_context_callback), |
| 38 resource_context_(resource_context), | 38 resource_context_(resource_context), |
| 39 weak_ptr_factory_(this), | 39 weak_ptr_factory_(this), |
| 40 on_shutdown_(false) { | 40 on_shutdown_(false) { |
| 41 net::WebSocketJob::EnsureInit(); | 41 net::WebSocketJob::EnsureInit(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool SocketStreamDispatcherHost::OnMessageReceived(const IPC::Message& message, | 44 bool SocketStreamDispatcherHost::OnMessageReceived( |
| 45 bool* message_was_ok) { | 45 const IPC::Message& message) { |
| 46 if (on_shutdown_) | 46 if (on_shutdown_) |
| 47 return false; | 47 return false; |
| 48 | 48 |
| 49 bool handled = true; | 49 bool handled = true; |
| 50 IPC_BEGIN_MESSAGE_MAP_EX(SocketStreamDispatcherHost, message, *message_was_ok) | 50 IPC_BEGIN_MESSAGE_MAP(SocketStreamDispatcherHost, message) |
| 51 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_Connect, OnConnect) | 51 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_Connect, OnConnect) |
| 52 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_SendData, OnSendData) | 52 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_SendData, OnSendData) |
| 53 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_Close, OnCloseReq) | 53 IPC_MESSAGE_HANDLER(SocketStreamHostMsg_Close, OnCloseReq) |
| 54 IPC_MESSAGE_UNHANDLED(handled = false) | 54 IPC_MESSAGE_UNHANDLED(handled = false) |
| 55 IPC_END_MESSAGE_MAP_EX() | 55 IPC_END_MESSAGE_MAP() |
| 56 return handled; | 56 return handled; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // SocketStream::Delegate methods implementations. | 59 // SocketStream::Delegate methods implementations. |
| 60 void SocketStreamDispatcherHost::OnConnected(net::SocketStream* socket, | 60 void SocketStreamDispatcherHost::OnConnected(net::SocketStream* socket, |
| 61 int max_pending_send_allowed) { | 61 int max_pending_send_allowed) { |
| 62 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); | 62 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); |
| 63 DVLOG(2) << "SocketStreamDispatcherHost::OnConnected socket_id=" << socket_id | 63 DVLOG(2) << "SocketStreamDispatcherHost::OnConnected socket_id=" << socket_id |
| 64 << " max_pending_send_allowed=" << max_pending_send_allowed; | 64 << " max_pending_send_allowed=" << max_pending_send_allowed; |
| 65 if (socket_id == kNoSocketId) { | 65 if (socket_id == kNoSocketId) { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 iter.Advance()) { | 298 iter.Advance()) { |
| 299 int socket_id = iter.GetCurrentKey(); | 299 int socket_id = iter.GetCurrentKey(); |
| 300 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); | 300 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); |
| 301 delete socket_stream_host; | 301 delete socket_stream_host; |
| 302 hosts_.Remove(socket_id); | 302 hosts_.Remove(socket_id); |
| 303 } | 303 } |
| 304 on_shutdown_ = true; | 304 on_shutdown_ = true; |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace content | 307 } // namespace content |
| OLD | NEW |