Index: content/renderer/browser_plugin/browser_plugin_compositing_filter.h |
diff --git a/content/renderer/browser_plugin/browser_plugin_compositing_filter.h b/content/renderer/browser_plugin/browser_plugin_compositing_filter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7103b3daa521bd0e4ee17cdeeb62df9e883a850d |
--- /dev/null |
+++ b/content/renderer/browser_plugin/browser_plugin_compositing_filter.h |
@@ -0,0 +1,54 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_FILTER_H_ |
+#define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_FILTER_H_ |
+ |
+#include <set> |
+ |
+#include "base/bind.h" |
+#include "base/callback_forward.h" |
+#include "base/task_runner.h" |
+#include "ipc/ipc_channel_proxy.h" |
+ |
+namespace content { |
+ |
+// This class allows forwarding of the compositing messages associated |
+// with browser plugin to the respective handler on the impl thread |
+class BrowserPluginCompositingFilter |
+ : public IPC::ChannelProxy::MessageFilter { |
+ public: |
+ |
+ typedef base::Callback<void(const IPC::Message&)> Handler; |
+ |
+ BrowserPluginCompositingFilter(base::TaskRunner* target_task_runner, |
+ int instance_id, |
+ const Handler& handler); |
+ |
+ // ChannelProxy::MessageFilter methods: |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ private: |
+ friend class IPC::ChannelProxy::MessageFilter; |
+ virtual ~BrowserPluginCompositingFilter(); |
+ |
+ int GetPluginInstanceID(const IPC::Message& message); |
+ |
+ // Message ID's the class knows how to handle |
+ std::set<int> message_ids_to_filter_; |
+ |
+ // The handler_ only gets Run on the thread corresponding to |
+ // target_task_runner_. |
+ scoped_refptr<base::TaskRunner> target_task_runner_; |
+ |
+ // Only handle messages for a specific browser plugin instance |
+ int instance_id_; |
+ Handler handler_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginCompositingFilter); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_COMPOSITING_FILTER_H_ |