diff options
Diffstat (limited to 'ppapi/proxy/host_dispatcher.h')
-rw-r--r-- | ppapi/proxy/host_dispatcher.h | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h index 10fca5c..623aa26 100644 --- a/ppapi/proxy/host_dispatcher.h +++ b/ppapi/proxy/host_dispatcher.h @@ -32,6 +32,7 @@ struct Preferences; namespace proxy { +class InterfaceProxy; class VarSerialization; class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher { @@ -79,11 +80,18 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher { // if the plugin supports the given interface (with caching) and returns the // pointer to the proxied interface if it is supported. Returns NULL if the // given interface isn't supported by the plugin or the proxy. - const void* GetProxiedInterface(const std::string& iface_name); + const void* GetProxiedInterface(const std::string& proxied_interface); + + // Returns the proxy object associated with the given interface ID, creating + // it if necessary. This is used in cases where a proxy needs to access code + // in the proxy for another interface. It's assumed that the interface always + // exists, so this is only used for browser proxies. + // + // Will return NULL if an interface isn't supported. + InterfaceProxy* GetOrCreatePPBInterfaceProxy(InterfaceID id); // See the value below. Call this when processing a scripting message from - // the plugin that can be reentered. This is set to false at the beginning - // of processing of each message from the plugin. + // the plugin that can be reentered. void set_allow_plugin_reentrancy() { allow_plugin_reentrancy_ = true; } @@ -91,17 +99,28 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher { // Returns the proxy interface for talking to the implementation. const PPB_Proxy_Private* ppb_proxy() const { return ppb_proxy_; } - protected: - // Overridden from Dispatcher. - virtual void OnInvalidMessageReceived(); - private: + friend class HostDispatcherTest; + + // Makes an instance of the given PPB interface proxy, storing it in the + // target_proxies_ array. An proxy for this interface must not exist yet. + InterfaceProxy* CreatePPBInterfaceProxy(const InterfaceProxy::Info* info); + PP_Module pp_module_; + typedef std::map<std::string, bool> PluginIFSupportedMap; // Maps interface name to whether that interface is supported. If an interface // name is not in the map, that implies that we haven't queried for it yet. - typedef base::hash_map<std::string, bool> PluginSupportedMap; - PluginSupportedMap plugin_supported_; + std::map<std::string, bool> plugin_if_supported_; + + // All target proxies currently created. These are ones that receive + // messages. They are created on demand when we receive messages. + scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; + + // Function proxies created for "new-style" FunctionGroups. + // TODO(brettw) this is in progress. It should be merged with the target + // proxies so there is one list to consult. + scoped_ptr<FunctionGroupBase> function_proxies_[INTERFACE_ID_COUNT]; // Guaranteed non-NULL. const PPB_Proxy_Private* ppb_proxy_; |