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

Unified Diff: content/plugin/plugin_channel_base.h

Issue 7037027: Fixes Issues #5751 & #22631: NPObject identity (Closed)
Patch Set: fixes bogus change 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
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..eb97938c3f1d082c3326089fbb6423344b08fb4c 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 AddMappingForProxy(int route_id, NPObject* object);
jam 2011/05/20 23:22:22 nit: we have several proxy/stub types. can you ca
Kelly Norton 2011/05/23 15:02:56 Done.
+ void RemoveMappingForProxy(int route_id);
+
+ void AddMappingForStub(int route_id, NPObject* object);
+ void RemoveMappingForStub(int route_id, NPObject* object);
+
+ NPObject* GetExistingProxy(int route_id);
+ int GetExistingRouteForStub(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_;

Powered by Google App Engine
This is Rietveld 408576698