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" |
11 #include "content/browser/ssl/ssl_manager.h" | 11 #include "content/browser/ssl/ssl_manager.h" |
12 #include "content/common/resource_messages.h" | 12 #include "content/common/resource_messages.h" |
13 #include "content/common/socket_stream.h" | 13 #include "content/common/socket_stream.h" |
14 #include "content/common/socket_stream_messages.h" | 14 #include "content/common/socket_stream_messages.h" |
15 #include "content/public/browser/content_browser_client.h" | 15 #include "content/public/browser/content_browser_client.h" |
16 #include "content/public/browser/global_request_id.h" | 16 #include "content/public/browser/global_request_id.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "net/cookies/canonical_cookie.h" | 18 #include "net/cookies/canonical_cookie.h" |
19 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
20 #include "net/websockets/websocket_job.h" | 20 #include "net/websockets/websocket_job.h" |
21 #include "net/websockets/websocket_throttle.h" | 21 #include "net/websockets/websocket_throttle.h" |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 const size_t kMaxSocketStreamHosts = 16 * 1024; | 27 const size_t kMaxSocketStreamHosts = 16 * 1024; |
28 | 28 |
| 29 const uint32 kFilteredMessageClasses[] = { |
| 30 SocketStreamMsgStart, |
| 31 }; |
| 32 |
29 } // namespace | 33 } // namespace |
30 | 34 |
31 SocketStreamDispatcherHost::SocketStreamDispatcherHost( | 35 SocketStreamDispatcherHost::SocketStreamDispatcherHost( |
32 int render_process_id, | 36 int render_process_id, |
33 const GetRequestContextCallback& request_context_callback, | 37 const GetRequestContextCallback& request_context_callback, |
34 ResourceContext* resource_context) | 38 ResourceContext* resource_context) |
35 : render_process_id_(render_process_id), | 39 : BrowserMessageFilter( |
| 40 kFilteredMessageClasses, arraysize(kFilteredMessageClasses)), |
| 41 render_process_id_(render_process_id), |
36 request_context_callback_(request_context_callback), | 42 request_context_callback_(request_context_callback), |
37 resource_context_(resource_context), | 43 resource_context_(resource_context), |
38 weak_ptr_factory_(this), | 44 weak_ptr_factory_(this), |
39 on_shutdown_(false) { | 45 on_shutdown_(false) { |
40 net::WebSocketJob::EnsureInit(); | 46 net::WebSocketJob::EnsureInit(); |
41 } | 47 } |
42 | 48 |
43 bool SocketStreamDispatcherHost::OnMessageReceived(const IPC::Message& message, | 49 bool SocketStreamDispatcherHost::OnMessageReceived(const IPC::Message& message, |
44 bool* message_was_ok) { | 50 bool* message_was_ok) { |
45 if (on_shutdown_) | 51 if (on_shutdown_) |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 iter.Advance()) { | 279 iter.Advance()) { |
274 int socket_id = iter.GetCurrentKey(); | 280 int socket_id = iter.GetCurrentKey(); |
275 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); | 281 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); |
276 delete socket_stream_host; | 282 delete socket_stream_host; |
277 hosts_.Remove(socket_id); | 283 hosts_.Remove(socket_id); |
278 } | 284 } |
279 on_shutdown_ = true; | 285 on_shutdown_ = true; |
280 } | 286 } |
281 | 287 |
282 } // namespace content | 288 } // namespace content |
OLD | NEW |