Index: gpu/demos/framework/main_pepper.cc |
=================================================================== |
--- gpu/demos/framework/main_pepper.cc (revision 38584) |
+++ gpu/demos/framework/main_pepper.cc (working copy) |
@@ -8,11 +8,20 @@ |
#include "gpu/pgl/pgl.h" |
#include "webkit/glue/plugins/nphostapi.h" |
+#if __GNUC__ >= 4 |
+#define EXPORT __attribute__ ((visibility("default"))) |
+#else |
+// We use .def file to export symbols on OS_WIN. We could potentially use |
+// __declspec(dllexport) but API_CALL always adds something to the function |
+// signature even inside extern "C" {} |
+#define EXPORT |
+#endif // GNUC |
+ |
namespace { |
// AtExitManager is used by singleton classes to delete themselves when |
// the program terminates. There should be only one instance of this class |
// per thread; |
-base::AtExitManager* g_at_exit_manager_; |
+base::AtExitManager* g_at_exit_manager; |
} // namespace |
namespace gpu { |
@@ -92,8 +101,19 @@ |
NPError err = NPERR_NO_ERROR; |
switch (variable) { |
+#if defined(OS_LINUX) |
+ case NPPVpluginNameString: |
+ *(static_cast<const char**>(value)) = "Pepper GPU Demo"; |
+ break; |
+ case NPPVpluginDescriptionString: |
+ *(static_cast<const char**>(value)) = "Pepper plug-in for GPU demo."; |
+ break; |
+ case NPPVpluginNeedsXEmbed: |
+ *(static_cast<NPBool*>(value)) = TRUE; |
+ break; |
+#endif |
case NPPVpluginScriptableNPObject: { |
- void** v = reinterpret_cast<void**>(value); |
+ void** v = static_cast<void**>(value); |
Plugin* plugin = static_cast<Plugin*>(instance->pdata); |
// Return value is expected to be retained |
g_browser->retainobject(plugin); |
@@ -117,7 +137,7 @@ |
// NP entry points |
extern "C" { |
-NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { |
+EXPORT NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { |
plugin_funcs->version = NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL; |
plugin_funcs->size = sizeof(plugin_funcs); |
plugin_funcs->newp = gpu::demos::NPP_New; |
@@ -137,15 +157,34 @@ |
return NPERR_NO_ERROR; |
} |
-NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs) { |
- g_at_exit_manager_ = new base::AtExitManager(); |
+EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs |
+#if defined(OS_LINUX) |
+ , NPPluginFuncs* plugin_funcs |
+#endif // OS_LINUX |
+ ) { |
+ g_at_exit_manager = new base::AtExitManager(); |
gpu::demos::g_browser = browser_funcs; |
pglInitialize(); |
+ |
+#if defined(OS_LINUX) |
+ NP_GetEntryPoints(plugin_funcs); |
+#endif // OS_LINUX |
return NPERR_NO_ERROR; |
} |
-void API_CALL NP_Shutdown() { |
+EXPORT void API_CALL NP_Shutdown() { |
pglTerminate(); |
- delete g_at_exit_manager_; |
+ delete g_at_exit_manager; |
} |
+ |
+#if defined(OS_LINUX) |
+EXPORT NPError API_CALL NP_GetValue(NPP instance, NPPVariable variable, |
+ void* value) { |
+ return gpu::demos::NPP_GetValue(instance, variable, value); |
+} |
+ |
+EXPORT const char* API_CALL NP_GetMIMEDescription() { |
+ return "pepper-application/x-gpu-demo::Pepper GPU Demo"; |
+} |
+#endif // OS_LINUX |
} // extern "C" |