Index: webkit/tools/pepper_test_plugin/main.cc |
=================================================================== |
--- webkit/tools/pepper_test_plugin/main.cc (revision 35905) |
+++ webkit/tools/pepper_test_plugin/main.cc (working copy) |
@@ -34,15 +34,21 @@ |
#include <stdlib.h> |
#include <stdio.h> |
+#if defined(INDEPENDENT_PLUGIN) |
+#include <iostream> |
+#define LOG(x) std::cerr |
+#else |
#include "base/logging.h" |
#include "base/string_util.h" |
+#endif |
+#include "webkit/glue/plugins/nphostapi.h" |
#include "webkit/tools/pepper_test_plugin/plugin_object.h" |
#include "webkit/tools/pepper_test_plugin/event_handler.h" |
-#ifdef WIN32 |
-#define NPAPI WINAPI |
-#else |
-#define NPAPI |
+#if __GNUC__ >= 4 |
+#define EXPORT __attribute__ ((visibility("default"))) |
+#elif defined(_MSC_VER) |
+#define EXPORT __declspec(dllexport) |
#endif |
namespace { |
@@ -51,7 +57,12 @@ |
va_list args; |
va_start(args, format); |
std::string message("PLUGIN: "); |
+#if defined(INDEPENDENT_PLUGIN) |
+ char msgbuf[100]; |
+ vsnprintf(msgbuf, sizeof(msgbuf), format, args); |
+#else |
StringAppendV(&message, format, args); |
+#endif |
va_end(args); |
NPObject* window_object = 0; |
@@ -99,34 +110,27 @@ |
// Plugin entry points |
extern "C" { |
-#if defined(OS_WIN) |
-//__declspec(dllexport) |
-#endif |
-NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs |
+EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs |
#if defined(OS_LINUX) |
, NPPluginFuncs* plugin_funcs |
#endif |
); |
-#if defined(OS_WIN) |
-//__declspec(dllexport) |
-#endif |
-NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs); |
+EXPORT NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* plugin_funcs); |
-#if defined(OS_WIN) |
-//__declspec(dllexport) |
-#endif |
-void NPAPI NP_Shutdown() { |
+EXPORT void API_CALL NP_Shutdown() { |
} |
#if defined(OS_LINUX) |
-NPError NP_GetValue(NPP instance, NPPVariable variable, void* value); |
-const char* NP_GetMIMEDescription(); |
+EXPORT NPError API_CALL NP_GetValue(NPP instance, |
+ NPPVariable variable, |
+ void* value); |
+EXPORT const char* API_CALL NP_GetMIMEDescription(); |
#endif |
} // extern "C" |
// Plugin entry points |
-NPError NPAPI NP_Initialize(NPNetscapeFuncs* browser_funcs |
+EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs |
#if defined(OS_LINUX) |
, NPPluginFuncs* plugin_funcs |
#endif |
@@ -141,7 +145,7 @@ |
// Entrypoints ----------------------------------------------------------------- |
-NPError NPAPI NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { |
+NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { |
plugin_funcs->version = 11; |
plugin_funcs->size = sizeof(plugin_funcs); |
plugin_funcs->newp = NPP_New; |
@@ -271,11 +275,11 @@ |
} |
#if defined(OS_LINUX) |
-NPError NP_GetValue(NPP instance, NPPVariable variable, void* value) { |
+NPError API_CALL NP_GetValue(NPP instance, NPPVariable variable, void* value) { |
return NPP_GetValue(instance, variable, value); |
} |
-const char* NP_GetMIMEDescription() { |
- return "pepper-application/x-pepper-test-plugin pepper test;"; |
+const char* API_CALL NP_GetMIMEDescription() { |
+ return "pepper-application/x-pepper-test-plugin::Pepper Test"; |
} |
#endif |