diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-10 21:16:34 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-10 21:16:34 +0000 |
commit | 2cc0622486b85be1e098ecd2af563c0fa9743b26 (patch) | |
tree | eb32a99ee1dddb5699ee5208bd2b153501020fb3 /ppapi/c/private | |
parent | 82388663bfbeb4dc2fc58e86f83505e67b483d31 (diff) | |
download | chromium_src-2cc0622486b85be1e098ecd2af563c0fa9743b26.zip chromium_src-2cc0622486b85be1e098ecd2af563c0fa9743b26.tar.gz chromium_src-2cc0622486b85be1e098ecd2af563c0fa9743b26.tar.bz2 |
Ensure that PP_Instance values are unique within a plugin process in addition
to within the renderer.
This works by having the renderer check with the plugin that a PP_Instance is
available before using it. If it's already seen, the renderer will generate a
new PP_Instance and retry.
For performance, this message is handled on the I/O thread of the plugin so it
will not be blocked by the actual plugin code.
This requires an unfortunate amount of plumbing. Since the renderer can't
depend directly on the proxy, we have a new PPB_Proxy function to set the
verification function used to perform this check.
There is also a new plugin dispatcher delegate where I moved some of the global
state to that used to go into the init function. Adding yet another parameter
there seemed unfortunate.
TEST=manual
BUG=74961
Review URL: http://codereview.chromium.org/6628019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77693 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/private')
-rw-r--r-- | ppapi/c/private/ppb_proxy_private.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ppapi/c/private/ppb_proxy_private.h b/ppapi/c/private/ppb_proxy_private.h index d003281..ae6a39e 100644 --- a/ppapi/c/private/ppb_proxy_private.h +++ b/ppapi/c/private/ppb_proxy_private.h @@ -5,11 +5,12 @@ #ifndef PPAPI_C_PRIVATE_PROXY_PRIVATE_H_ #define PPAPI_C_PRIVATE_PROXY_PRIVATE_H_ +#include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_module.h" #include "ppapi/c/pp_resource.h" -#define PPB_PROXY_PRIVATE_INTERFACE "PPB_Proxy_Private;2" +#define PPB_PROXY_PRIVATE_INTERFACE "PPB_Proxy_Private;3" // Exposes functions needed by the out-of-process proxy to call into the // renderer PPAPI implementation. @@ -19,6 +20,19 @@ struct PPB_Proxy_Private { // Returns the instance for the given resource, or 0 on failure. PP_Instance (*GetInstanceForResource)(PP_Resource resource); + + // Sets a callback that will be used to make sure that PP_Instance IDs + // are unique in the plugin. + // + // Since the plugin may be shared between several browser processes, we need + // to do extra work to make sure that an instance ID is globally unqiue. The + // given function will be called and will return true if the given + // PP_Instance is OK to use in the plugin. It will then be marked as "in use" + // On failure (returns false), the host implementation will generate a new + // instance ID and try again. + void (*SetReserveInstanceIDCallback)( + PP_Module module, + PP_Bool (*is_seen)(PP_Module, PP_Instance)); }; #endif // PPAPI_C_PRIVATE_PROXY_PRIVATE_H_ |