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

Unified Diff: content/plugin/plugin_channel_base.h

Issue 7037027: Fixes Issues #5751 & #22631: NPObject identity (Closed)
Patch Set: hopefully added base url Created 9 years, 7 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 | « content/plugin/npobject_util.cc ('k') | content/plugin/plugin_channel_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/plugin/plugin_channel_base.h
diff --git a/content/plugin/plugin_channel_base.h b/content/plugin/plugin_channel_base.h
index fb699803d61c92bac8f08ab565fb42268397dcbf..6621409955a5c0bd9469c4cc3663891740015d90 100644
--- a/content/plugin/plugin_channel_base.h
+++ b/content/plugin/plugin_channel_base.h
@@ -22,6 +22,28 @@ namespace base {
class MessageLoopProxy;
}
+#if defined(COMPILER_GCC)
+namespace __gnu_cxx {
+
+template<>
+struct hash<NPObject*> {
+ std::size_t operator()(NPObject* const& ptr) const {
+ return hash<size_t>()(reinterpret_cast<size_t>(ptr));
+ }
+};
+
+} // namespace __gnu_cxx
+#elif defined(COMPILER_MSVC)
+namespace stdext {
+
+template<>
+inline size_t hash_value(NPObject* const& ptr) {
+ return hash_value(reinterpret_cast<size_t>(ptr));
+}
+
+} // namespace stdext
+#endif // COMPILER
+
// Encapsulates an IPC channel between a renderer and a plugin process.
class PluginChannelBase : public IPC::Channel::Listener,
public IPC::Message::Sender,
@@ -38,6 +60,17 @@ class PluginChannelBase : public IPC::Channel::Listener,
NPObjectBase* npobject);
void RemoveRoute(int route_id);
+
+ void AddMappingForNPObjectProxy(int route_id, NPObject* object);
+ void RemoveMappingForNPObjectProxy(int route_id);
+
+ void AddMappingForNPObjectStub(int route_id, NPObject* object);
+ void RemoveMappingForNPObjectStub(int route_id, NPObject* object);
+
+ NPObject* GetExistingNPObjectProxy(int route_id);
+ int GetExistingRouteForNPObjectStub(NPObject* npobject);
+
+
// IPC::Message::Sender implementation:
virtual bool Send(IPC::Message* msg);
@@ -122,6 +155,12 @@ class PluginChannelBase : public IPC::Channel::Listener,
typedef base::hash_map<int, NPObjectBase*> ListenerMap;
ListenerMap npobject_listeners_;
+ typedef base::hash_map<int, NPObject*> ProxyMap;
+ ProxyMap proxy_map_;
+
+ typedef base::hash_map<NPObject*, int> StubMap;
+ StubMap stub_map_;
+
// Used to implement message routing functionality to WebPlugin[Delegate]
// objects
MessageRouter router_;
« no previous file with comments | « content/plugin/npobject_util.cc ('k') | content/plugin/plugin_channel_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698