diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 03:31:30 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 03:31:30 +0000 |
commit | 7937c488c70c060f4f6a379c03d9c8c62733e5fa (patch) | |
tree | 7a19202d3718d86320e496eca0f77019354e4f9a /ppapi/proxy/host_dispatcher.h | |
parent | 6569dad2bd6c330ce6cf006cc952feecd57b0f87 (diff) | |
download | chromium_src-7937c488c70c060f4f6a379c03d9c8c62733e5fa.zip chromium_src-7937c488c70c060f4f6a379c03d9c8c62733e5fa.tar.gz chromium_src-7937c488c70c060f4f6a379c03d9c8c62733e5fa.tar.bz2 |
This patch tries to remove most of the manual registration for Pepper interfaces, and replaces it with a list of macros. When files want to know which Pepper interface names and structs there are, they define what they want to do with the macros, and then include the relevant files for the classes of interfaces they want (stable, private, dev).
This re-lands my previous change.
Original Review URL: http://codereview.chromium.org/7740038
This does not convert all the dev interfaces. I just did a few to keep the patch smaller. So there is still a lot of manual registration.
This fixes the previous design problem where we assumed one *_Proxy object == one interface. We have been hacking around this lately with duplicate GetInfo calls, but this doesn't work for PPP interfaces.
Now, a _Proxy object is just there to help keep things organized. One proxy can handle zero, one, or many interfaces, and this mapping is controlled by just one line in the interfaces file.
So for example, to add a new function to a new version of an interface with backward compatibility, you would add that function to the _api.h file, and write a thunk for the new interface. Then you only need to add one line to the interfaces_ppb_public_stable.h file and that will be hooked up with the proxy and the implementation.
This removes some _proxy objects/files that were used only to declare that the interfaces existed, since they're no longer necessary.
I folded Console into the Instance API which removed a bunch of code.
I removed FileChooser 0.4. I think everybody has converted to the new one, and I think parts of it weren't even hooked up properly anymore.
Review URL: http://codereview.chromium.org/7874002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100851 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/host_dispatcher.h')
-rw-r--r-- | ppapi/proxy/host_dispatcher.h | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h index 623aa26..10fca5c 100644 --- a/ppapi/proxy/host_dispatcher.h +++ b/ppapi/proxy/host_dispatcher.h @@ -32,7 +32,6 @@ struct Preferences; namespace proxy { -class InterfaceProxy; class VarSerialization; class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher { @@ -80,18 +79,11 @@ 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& 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); + const void* GetProxiedInterface(const std::string& iface_name); // See the value below. Call this when processing a scripting message from - // the plugin that can be reentered. + // the plugin that can be reentered. This is set to false at the beginning + // of processing of each message from the plugin. void set_allow_plugin_reentrancy() { allow_plugin_reentrancy_ = true; } @@ -99,28 +91,17 @@ 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_; } - 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); + protected: + // Overridden from Dispatcher. + virtual void OnInvalidMessageReceived(); + private: 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. - 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]; + typedef base::hash_map<std::string, bool> PluginSupportedMap; + PluginSupportedMap plugin_supported_; // Guaranteed non-NULL. const PPB_Proxy_Private* ppb_proxy_; |