Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: ppapi/proxy/plugin_message_filter.h

Issue 6628019: Ensure that PP_Instance values are unique within a plugin process in addition... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/plugin_dispatcher.cc ('k') | ppapi/proxy/plugin_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/plugin_message_filter.h
===================================================================
--- ppapi/proxy/plugin_message_filter.h (revision 0)
+++ ppapi/proxy/plugin_message_filter.h (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (c) 2011 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 PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_
+#define PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_
+
+#include <set>
+
+#include "ipc/ipc_channel_proxy.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_instance.h"
+
+namespace pp {
+namespace proxy {
+
+// Listens for messages on the I/O thread of the plugin and handles some of
+// them to avoid needing to block on the plugin.
+//
+// There is one instance of this class for each renderer channel (same as for
+// the PluginDispatchers).
+class PluginMessageFilter : public IPC::ChannelProxy::MessageFilter,
+ public IPC::Message::Sender {
+ public:
+ // The input is a pointer to a set that will be used to uniquify PP_Instances
+ // across all renderer channels. The same pointer should be passed to each
+ // MessageFilter to ensure uniqueness, and the value should outlive this
+ // class.
+ PluginMessageFilter(std::set<PP_Instance>* seen_instance_ids);
+ virtual ~PluginMessageFilter();
+
+ // MessageFilter implementation.
+ virtual void OnFilterAdded(IPC::Channel* channel);
+ virtual void OnFilterRemoved();
+ virtual bool OnMessageReceived(const IPC::Message& message);
+
+ // Message::Sender implementation.
+ virtual bool Send(IPC::Message* msg);
+
+ private:
+ void OnMsgReserveInstanceId(PP_Instance instance, bool* usable);
+
+ // All instance IDs every queried by any renderer on this plugin. This is
+ // used to make sure that new instance IDs are unique. This is a non-owning
+ // pointer, it will be managed by the later that creates this class.
+ std::set<PP_Instance>* seen_instance_ids_;
+
+ // The IPC channel to the renderer. May be NULL if we're not currently
+ // attached as a filter.
+ IPC::Channel* channel_;
+};
+
+} // namespace proxy
+} // namespace pp
+
+#endif // PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_
Property changes on: ppapi/proxy/plugin_message_filter.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « ppapi/proxy/plugin_dispatcher.cc ('k') | ppapi/proxy/plugin_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698