OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_FILTER_H_ |
| 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_FILTER_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "base/bind.h" |
| 11 #include "base/callback_forward.h" |
| 12 #include "base/task_runner.h" |
| 13 #include "ipc/ipc_channel_proxy.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 // This class allows forwarding of the compositing messages associated |
| 18 // with browser plugin to the respective handler on the impl thread |
| 19 class BrowserPluginCompositingFilter |
| 20 : public IPC::ChannelProxy::MessageFilter { |
| 21 public: |
| 22 |
| 23 typedef base::Callback<void(const IPC::Message&)> Handler; |
| 24 |
| 25 BrowserPluginCompositingFilter(base::TaskRunner* target_task_runner, |
| 26 int instance_id, |
| 27 const Handler& handler); |
| 28 |
| 29 // ChannelProxy::MessageFilter methods: |
| 30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 31 |
| 32 private: |
| 33 friend class IPC::ChannelProxy::MessageFilter; |
| 34 virtual ~BrowserPluginCompositingFilter(); |
| 35 |
| 36 int GetPluginInstanceID(const IPC::Message& message); |
| 37 |
| 38 // Message ID's the class knows how to handle |
| 39 std::set<int> message_ids_to_filter_; |
| 40 |
| 41 // The handler_ only gets Run on the thread corresponding to |
| 42 // target_task_runner_. |
| 43 scoped_refptr<base::TaskRunner> target_task_runner_; |
| 44 |
| 45 // Only handle messages for a specific browser plugin instance |
| 46 int instance_id_; |
| 47 Handler handler_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(BrowserPluginCompositingFilter); |
| 50 }; |
| 51 |
| 52 } // namespace content |
| 53 |
| 54 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_FILTER_H_ |
OLD | NEW |