Chromium Code Reviews| 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_; |