| 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 14 matching lines...) Expand all Loading... |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 const size_t kMaxSocketStreamHosts = 16 * 1024; | 27 const size_t kMaxSocketStreamHosts = 16 * 1024; |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 SocketStreamDispatcherHost::SocketStreamDispatcherHost( | 31 SocketStreamDispatcherHost::SocketStreamDispatcherHost( |
| 32 int render_process_id, | 32 int render_process_id, |
| 33 const GetRequestContextCallback& request_context_callback, | 33 const GetRequestContextCallback& request_context_callback, |
| 34 ResourceContext* resource_context) | 34 ResourceContext* resource_context) |
| 35 : render_process_id_(render_process_id), | 35 : BrowserMessageFilter(SocketStreamMsgStart), |
| 36 render_process_id_(render_process_id), |
| 36 request_context_callback_(request_context_callback), | 37 request_context_callback_(request_context_callback), |
| 37 resource_context_(resource_context), | 38 resource_context_(resource_context), |
| 38 weak_ptr_factory_(this), | 39 weak_ptr_factory_(this), |
| 39 on_shutdown_(false) { | 40 on_shutdown_(false) { |
| 40 net::WebSocketJob::EnsureInit(); | 41 net::WebSocketJob::EnsureInit(); |
| 41 } | 42 } |
| 42 | 43 |
| 43 bool SocketStreamDispatcherHost::OnMessageReceived(const IPC::Message& message, | 44 bool SocketStreamDispatcherHost::OnMessageReceived(const IPC::Message& message, |
| 44 bool* message_was_ok) { | 45 bool* message_was_ok) { |
| 45 if (on_shutdown_) | 46 if (on_shutdown_) |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 iter.Advance()) { | 274 iter.Advance()) { |
| 274 int socket_id = iter.GetCurrentKey(); | 275 int socket_id = iter.GetCurrentKey(); |
| 275 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); | 276 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); |
| 276 delete socket_stream_host; | 277 delete socket_stream_host; |
| 277 hosts_.Remove(socket_id); | 278 hosts_.Remove(socket_id); |
| 278 } | 279 } |
| 279 on_shutdown_ = true; | 280 on_shutdown_ = true; |
| 280 } | 281 } |
| 281 | 282 |
| 282 } // namespace content | 283 } // namespace content |
| OLD | NEW |