OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_CHILD_WEBSOCKET_MESSAGE_FILTER_H_ |
| 6 #define CONTENT_CHILD_WEBSOCKET_MESSAGE_FILTER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "ipc/message_filter.h" |
| 11 |
| 12 namespace base { |
| 13 class SingleThreadTaskRunner; |
| 14 } |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class WebSocketDispatcher; |
| 19 |
| 20 // Delegates IPC messages to a WebSocketDispatcher on the loading task queue |
| 21 // instead of the default task queue. |
| 22 class WebSocketMessageFilter : public IPC::MessageFilter { |
| 23 public: |
| 24 explicit WebSocketMessageFilter(WebSocketDispatcher* websocket_dispatcher); |
| 25 |
| 26 // IPC::MessageFilter implementation. |
| 27 bool OnMessageReceived(const IPC::Message& message) override; |
| 28 |
| 29 void SetLoadingTaskRunner( |
| 30 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner) { |
| 31 loading_task_runner_ = loading_task_runner; |
| 32 } |
| 33 |
| 34 private: |
| 35 ~WebSocketMessageFilter() override; |
| 36 |
| 37 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner_; |
| 38 |
| 39 // This is owned by a RenderThreadImpl and lives when the renderer process |
| 40 // lives. |
| 41 WebSocketDispatcher* websocket_dispatcher_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(WebSocketMessageFilter); |
| 44 }; |
| 45 |
| 46 } // namespace content |
| 47 |
| 48 #endif // CONTENT_CHILD_WEBSOCKET_MESSAGE_FILTER_H_ |
OLD | NEW |