From 0c410a1ec6bfcb72e0baa607fb208040668d61d9 Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Thu, 28 Jun 2012 20:56:29 +0000 Subject: [PATCH] [EFL] Use Eina_Module API instead of dlopen in PluginPackageEfl https://bugs.webkit.org/show_bug.cgi?id=89972 Patch by Christophe Dumez on 2012-06-28 Reviewed by Antonio Gomes. Use convenience helpers in Eina_Module to load plugins instead of POSIX dlopen(). No new tests, behavior has not changed. * platform/FileSystem.h: (WebCore): * platform/efl/FileSystemEfl.cpp: (WebCore::unloadModule): * plugins/efl/PluginPackageEfl.cpp: (WebCore::PluginPackage::load): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121467 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 19 +++++++++++++ Source/WebCore/platform/FileSystem.h | 6 +++++ Source/WebCore/platform/efl/FileSystemEfl.cpp | 2 +- Source/WebCore/plugins/efl/PluginPackageEfl.cpp | 36 ++++++++++++------------- 4 files changed, 44 insertions(+), 19 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index f0fa796..3c6e08f 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,22 @@ +2012-06-28 Christophe Dumez + + [EFL] Use Eina_Module API instead of dlopen in PluginPackageEfl + https://bugs.webkit.org/show_bug.cgi?id=89972 + + Reviewed by Antonio Gomes. + + Use convenience helpers in Eina_Module to load plugins instead + of POSIX dlopen(). + + No new tests, behavior has not changed. + + * platform/FileSystem.h: + (WebCore): + * platform/efl/FileSystemEfl.cpp: + (WebCore::unloadModule): + * plugins/efl/PluginPackageEfl.cpp: + (WebCore::PluginPackage::load): + 2012-06-28 Jocelyn Turcotte [Qt] Fix TextureMapper rendering of GraphicsSurface on Mac diff --git a/Source/WebCore/platform/FileSystem.h b/Source/WebCore/platform/FileSystem.h index b3c259a..a6b3a67 100644 --- a/Source/WebCore/platform/FileSystem.h +++ b/Source/WebCore/platform/FileSystem.h @@ -71,6 +71,10 @@ typedef struct _GFileIOStream GFileIOStream; typedef struct _GModule GModule; #endif +#if PLATFORM(EFL) +typedef struct _Eina_Module Eina_Module; +#endif + namespace WebCore { // PlatformModule @@ -78,6 +82,8 @@ namespace WebCore { typedef HMODULE PlatformModule; #elif PLATFORM(GTK) typedef GModule* PlatformModule; +#elif PLATFORM(EFL) +typedef Eina_Module* PlatformModule; #elif PLATFORM(QT) #if defined(Q_WS_MAC) typedef CFBundleRef PlatformModule; diff --git a/Source/WebCore/platform/efl/FileSystemEfl.cpp b/Source/WebCore/platform/efl/FileSystemEfl.cpp index c6bff15..0caae89 100644 --- a/Source/WebCore/platform/efl/FileSystemEfl.cpp +++ b/Source/WebCore/platform/efl/FileSystemEfl.cpp @@ -70,7 +70,7 @@ bool unloadModule(PlatformModule module) // caution, closing handle will make memory vanish and any remaining // timer, idler, threads or any other left-over will crash, // maybe just ignore this is a safer solution? - return !dlclose(module); + return eina_module_free(module); } String homeDirectoryPath() diff --git a/Source/WebCore/plugins/efl/PluginPackageEfl.cpp b/Source/WebCore/plugins/efl/PluginPackageEfl.cpp index 7b950d3..5753ed7 100644 --- a/Source/WebCore/plugins/efl/PluginPackageEfl.cpp +++ b/Source/WebCore/plugins/efl/PluginPackageEfl.cpp @@ -111,33 +111,33 @@ uint16_t PluginPackage::NPVersion() const bool PluginPackage::load() { - char* errmsg; - if (m_isLoaded) { - m_loadCount++; + ++m_loadCount; return true; } - m_module = dlopen(m_path.utf8().data(), RTLD_LAZY | RTLD_LOCAL); - if ((errmsg = dlerror())) { - EINA_LOG_WARN("%s not loaded: %s", m_path.utf8().data(), errmsg); + m_module = eina_module_new(m_path.utf8().data()); + if (!m_module) { + EINA_LOG_WARN("%s not loaded: eina_module_new() failed", m_path.utf8().data()); + return false; + } + if (!eina_module_load(m_module)) { + const char* errorMessage = eina_error_msg_get(eina_error_get()); + EINA_LOG_WARN("%s not loaded: %s", m_path.utf8().data(), errorMessage ? errorMessage : "None"); return false; } m_isLoaded = true; - NP_InitializeFuncPtr initialize; - NPError err; - - initialize = reinterpret_cast(dlsym(m_module, "NP_Initialize")); - if ((errmsg = dlerror())) { - EINA_LOG_ERR("Could not get symbol NP_Initialize: %s", errmsg); + NP_InitializeFuncPtr initialize = reinterpret_cast(eina_module_symbol_get(m_module, "NP_Initialize")); + if (!initialize) { + EINA_LOG_ERR("Could not get symbol NP_Initialize"); goto abort; } - m_NPP_Shutdown = reinterpret_cast(dlsym(m_module, "NP_Shutdown")); - if ((errmsg = dlerror())) { - EINA_LOG_ERR("Could not get symbol NP_Shutdown: %s", errmsg); + m_NPP_Shutdown = reinterpret_cast(eina_module_symbol_get(m_module, "NP_Shutdown")); + if (!m_NPP_Shutdown) { + EINA_LOG_ERR("Could not get symbol NP_Shutdown"); goto abort; } @@ -147,14 +147,14 @@ bool PluginPackage::load() initializeBrowserFuncs(); #if defined(XP_UNIX) - err = initialize(&m_browserFuncs, &m_pluginFuncs); + NPError err = initialize(&m_browserFuncs, &m_pluginFuncs); #else - err = initialize(&m_browserFuncs); + NPError err = initialize(&m_browserFuncs); #endif if (err != NPERR_NO_ERROR) goto abort; - m_loadCount++; + ++m_loadCount; return true; abort: -- 2.7.4