diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-28 15:13:10 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-28 15:13:10 +0000 |
commit | 8cc9dd62ea7a7d60ce5486fbd62baf9266fa0f15 (patch) | |
tree | 2c8b16963720b487ff79da260c4789891df4bd99 /webkit/glue/plugins/pepper_plugin_module.h | |
parent | 241a4f1e1c2164ae31b37cec47ffde2e0c71aed8 (diff) | |
download | chromium_src-8cc9dd62ea7a7d60ce5486fbd62baf9266fa0f15.zip chromium_src-8cc9dd62ea7a7d60ce5486fbd62baf9266fa0f15.tar.gz chromium_src-8cc9dd62ea7a7d60ce5486fbd62baf9266fa0f15.tar.bz2 |
Add in support for internal pepper plugins into the PepperPluginRegistry and pepper::PluginModule.
Used Chromoting's plugin as the first attempt at using this interface.
BUG=none
TEST=compiles
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=50667
Review URL: http://codereview.chromium.org/2843018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50976 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins/pepper_plugin_module.h')
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_module.h | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/webkit/glue/plugins/pepper_plugin_module.h b/webkit/glue/plugins/pepper_plugin_module.h index 0498c45..1b2d9fb 100644 --- a/webkit/glue/plugins/pepper_plugin_module.h +++ b/webkit/glue/plugins/pepper_plugin_module.h @@ -12,6 +12,7 @@ #include "base/native_library.h" #include "base/ref_counted.h" #include "third_party/ppapi/c/pp_module.h" +#include "third_party/ppapi/c/ppb.h" namespace pepper { @@ -20,9 +21,27 @@ class PluginInstance; class PluginModule : public base::RefCounted<PluginModule> { public: + typedef const void* (*PPP_GetInterfaceFunc)(const char*); + typedef int (*PPP_InitializeModuleFunc)(PP_Module, PPB_GetInterface); + typedef void (*PPP_ShutdownModuleFunc)(); + + struct EntryPoints { + EntryPoints() + : get_interface(NULL), + initialize_module(NULL), + shutdown_module(NULL) { + } + + PPP_GetInterfaceFunc get_interface; + PPP_InitializeModuleFunc initialize_module; + PPP_ShutdownModuleFunc shutdown_module; + }; + ~PluginModule(); - static scoped_refptr<PluginModule> CreateModule(const FilePath& filename); + static scoped_refptr<PluginModule> CreateModule(const FilePath& path); + static scoped_refptr<PluginModule> CreateInternalModule( + EntryPoints entry_points); // Converts the given module ID to an actual module object. Will return NULL // if the module is invalid. @@ -47,18 +66,24 @@ class PluginModule : public base::RefCounted<PluginModule> { void InstanceDeleted(PluginInstance* instance); private: - typedef const void* (*PPP_GetInterfaceFunc)(const char*); - - explicit PluginModule(const FilePath& filename); + PluginModule(); - bool Load(); - - FilePath filename_; + bool InitFromEntryPoints(const EntryPoints& entry_points); + bool InitFromFile(const FilePath& path); + static bool LoadEntryPoints(const base::NativeLibrary& library, + EntryPoints* entry_points); bool initialized_; + + // Holds a reference to the base::NativeLibrary handle if this PluginModule + // instance wraps functions loaded from a library. Can be NULL. If + // |library_| is non-NULL, PluginModule will attempt to unload the library + // during destruction. base::NativeLibrary library_; - PPP_GetInterfaceFunc ppp_get_interface_; + // Contains pointers to the entry points of the actual plugin + // implementation. + EntryPoints entry_points_; // Non-owning pointers to all instances associated with this module. When // there are no more instances, this object should be deleted. |