[Libreoffice-commits] core.git: solenv/bin stoc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 15 06:49:00 UTC 2020


 solenv/bin/native-code.py                                  |    3 
 stoc/source/invocation_adapterfactory/iafactory.cxx        |   49 ++-----------
 stoc/source/invocation_adapterfactory/invocadapt.component |    5 -
 3 files changed, 16 insertions(+), 41 deletions(-)

New commits:
commit 96ada688eaf7454791a5d8f8e0abe68e2c417e26
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Jul 13 22:21:38 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 15 08:48:13 2020 +0200

    stoc/invocadapt: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: Ie1c953c58688a0dfbbc8a40385e400b8d0314f3e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98699
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 2d0b810058c4..6ca8e8d2d1da 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -23,7 +23,6 @@ core_factory_list = [
     ("libembobj.a", "embobj_component_getFactory"),
     ("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
     ("libi18npoollo.a", "i18npool_component_getFactory"),
-    ("libinvocadaptlo.a", "invocadapt_component_getFactory"),
     ("libpackage2.a", "package2_component_getFactory"),
     ("libsmlo.a", "sm_component_getFactory"),
     ("libsrtrs1.a", "srtrs1_component_getFactory"),
@@ -262,6 +261,8 @@ core_constructor_list = [
     "com_sun_star_comp_embed_OLESimpleStorage",
 # stoc/source/inspect/introspection.component
     "com_sun_star_comp_stoc_Introspection_get_implementation",
+# stoc/source/invocation_adapter/invocadapt.component
+    "stoc_invocation_adapter_get_implementation",
 # stoc/source/corereflection/reflection.component
     "com_sun_star_comp_stoc_CoreReflection_get_implementation",
 # stoc/util/stocservices.component
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index cfa05e15e585..65322c3a6234 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -23,6 +23,7 @@
 #include <osl/mutex.hxx>
 #include <o3tl/sorted_vector.hxx>
 #include <sal/log.hxx>
+#include <rtl/ref.hxx>
 
 #include <uno/dispatcher.h>
 #include <uno/data.h>
@@ -30,9 +31,7 @@
 #include <uno/lbnames.h>
 #include <uno/mapping.hxx>
 
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/implbase.hxx>
-#include <cppuhelper/implementationentry.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
 #include <com/sun/star/script/XTypeConverter.hpp>
@@ -48,8 +47,6 @@
 #include <unordered_set>
 #include <vector>
 
-#define IMPLNAME    "com.sun.star.comp.stoc.InvocationAdapterFactory"
-
 using namespace ::std;
 using namespace ::osl;
 using namespace ::com::sun::star;
@@ -58,16 +55,6 @@ using namespace css::uno;
 namespace stoc_invadp
 {
 
-static Sequence< OUString > invadp_getSupportedServiceNames()
-{
-    Sequence< OUString > seqNames { "com.sun.star.script.InvocationAdapterFactory" };
-    return seqNames;
-}
-
-static OUString invadp_getImplementationName()
-{
-    return IMPLNAME;
-}
 
 namespace {
 
@@ -869,7 +856,7 @@ Reference< XInterface > FactoryImpl::createAdapter(
 
 OUString FactoryImpl::getImplementationName()
 {
-    return invadp_getImplementationName();
+    return "com.sun.star.comp.stoc.InvocationAdapterFactory";
 }
 
 sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
@@ -879,36 +866,22 @@ sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
 
 Sequence< OUString > FactoryImpl::getSupportedServiceNames()
 {
-    return invadp_getSupportedServiceNames();
-}
-
-/// @throws Exception
-static Reference< XInterface > FactoryImpl_create(
-    const Reference< XComponentContext > & xContext )
-{
-    return static_cast<cppu::OWeakObject *>(new FactoryImpl( xContext ));
+    return { "com.sun.star.script.InvocationAdapterFactory" };
 }
 
 }
 
 
-const struct ::cppu::ImplementationEntry g_entries[] =
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+stoc_invocation_adapter_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    {
-        ::stoc_invadp::FactoryImpl_create,
-        ::stoc_invadp::invadp_getImplementationName,
-        ::stoc_invadp::invadp_getSupportedServiceNames,
-        ::cppu::createOneInstanceComponentFactory,
-        nullptr, 0
-    },
-    { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
+    static rtl::Reference<stoc_invadp::FactoryImpl> g_Instance(new stoc_invadp::FactoryImpl(context));
 
-extern "C" SAL_DLLPUBLIC_EXPORT void * invocadapt_component_getFactory(
-    const char * pImplName, void * pServiceManager, void * pRegistryKey )
-{
-    return ::cppu::component_getFactoryHelper(
-        pImplName, pServiceManager, pRegistryKey , g_entries );
+    g_Instance->acquire();
+    return static_cast<cppu::OWeakObject*>(g_Instance.get());
 }
 
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/invocation_adapterfactory/invocadapt.component b/stoc/source/invocation_adapterfactory/invocadapt.component
index 85f29833808f..9dbf20e48bad 100644
--- a/stoc/source/invocation_adapterfactory/invocadapt.component
+++ b/stoc/source/invocation_adapterfactory/invocadapt.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="invocadapt" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.stoc.InvocationAdapterFactory">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.stoc.InvocationAdapterFactory"
+    constructor="stoc_invocation_adapter_get_implementation">
     <service name="com.sun.star.script.InvocationAdapterFactory"/>
   </implementation>
 </component>


More information about the Libreoffice-commits mailing list