diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 16:31:46 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 16:31:46 +0000 |
commit | 465faa29046328890a224677db522f1aece8cad0 (patch) | |
tree | 5cf23803cc13d27c71c05c4532a5fc434e6d7e4d /ppapi/proxy/host_dispatcher.h | |
parent | a313e51c562c3d3400d2bd14231f23e9ca699857 (diff) | |
download | chromium_src-465faa29046328890a224677db522f1aece8cad0.zip chromium_src-465faa29046328890a224677db522f1aece8cad0.tar.gz chromium_src-465faa29046328890a224677db522f1aece8cad0.tar.bz2 |
Rent syncemove all uses of the global Dispatcher Get function.
This reqired reworking how plugin->host GetInterface works. Previously,
interface requests were symmetric where each side would first do a
SupportsInterface to see if the remote side supports the interface, then create
the proxy. Since the plugin may talk to multiple renderers, we don't know where
to send these requests. The solution is to make the assumption that the
renderer always supports all PPB interfaces (which is possible since the proxy
is compiled with the executable).
This also adds some better lookup for interfaces to avoid having multiple lists
of interfaces. We now have a list of interfaces and factory functions in
dispatcher.cc.
Add some additional testing infrastructure for the dispatchers with simple tests.
Review URL: http://codereview.chromium.org/6286070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/host_dispatcher.h')
-rw-r--r-- | ppapi/proxy/host_dispatcher.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h index 2112405..f405f71 100644 --- a/ppapi/proxy/host_dispatcher.h +++ b/ppapi/proxy/host_dispatcher.h @@ -41,10 +41,6 @@ class HostDispatcher : public Dispatcher { GetInterfaceFunc local_get_interface); ~HostDispatcher(); - // Calls the plugin's PPP_InitializeModule function and returns true if - // the call succeeded. - bool InitializeModule(); - // The host side maintains a mapping from PP_Instance to Dispatcher so // that we can send the messages to the right channel. static HostDispatcher* GetForInstance(PP_Instance instance); @@ -52,10 +48,36 @@ class HostDispatcher : public Dispatcher { HostDispatcher* dispatcher); static void RemoveForInstance(PP_Instance instance); + // Calls the plugin's PPP_InitializeModule function and returns true if + // the call succeeded. + bool InitializeModule(); + // Dispatcher overrides. virtual bool IsPlugin() const; + // IPC::Channel::Listener. + virtual bool OnMessageReceived(const IPC::Message& msg); + + // Proxied version of calling GetInterface on the plugin. This will check + // 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& interface); + private: + friend class HostDispatcherTest; + + enum PluginInterfaceSupport { + INTERFACE_UNQUERIED = 0, // Must be 0 so memset(0) will clear the list. + INTERFACE_SUPPORTED, + INTERFACE_UNSUPPORTED + }; + PluginInterfaceSupport plugin_interface_support_[INTERFACE_ID_COUNT]; + + // 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]; + DISALLOW_COPY_AND_ASSIGN(HostDispatcher); }; |