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

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


 solenv/bin/native-code.py                    |    3 +
 stoc/source/proxy_factory/proxyfac.component |    5 +-
 stoc/source/proxy_factory/proxyfac.cxx       |   46 ++++-----------------------
 3 files changed, 13 insertions(+), 41 deletions(-)

New commits:
commit 0c688d3491c6f53ed06fbc5946e043e3b7509c63
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Jul 13 22:07:23 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 15 10:05:23 2020 +0200

    stoc/proxy: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: Ic55e4779af26378a41cf31465d4cafd429085596
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98696
    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 6ca8e8d2d1da..11952f14333d 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -35,7 +35,6 @@ core_factory_list = [
     ("libvcllo.a", "vcl_component_getFactory"),
     ("libsvtlo.a", "svt_component_getFactory"),
     ("libMacOSXSpelllo.a", "MacOSXSpell_component_getFactory", "#ifdef IOS"),
-    ("libproxyfaclo.a", "proxyfac_component_getFactory"),
     ("libbiblo.a", "bib_component_getFactory"),
     ]
 
@@ -265,6 +264,8 @@ core_constructor_list = [
     "stoc_invocation_adapter_get_implementation",
 # stoc/source/corereflection/reflection.component
     "com_sun_star_comp_stoc_CoreReflection_get_implementation",
+# stoc/source/proxy_factory/proxyfac.component
+    "stoc_FactoryImpl_get_implementation",
 # stoc/util/stocservices.component
     "com_sun_star_comp_stoc_OServiceManagerWrapper_get_implementation",
     "com_sun_star_comp_stoc_TypeConverter_get_implementation",
diff --git a/stoc/source/proxy_factory/proxyfac.component b/stoc/source/proxy_factory/proxyfac.component
index 69e573f5e761..eee87014ca98 100644
--- a/stoc/source/proxy_factory/proxyfac.component
+++ b/stoc/source/proxy_factory/proxyfac.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="proxyfac" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.reflection.ProxyFactory">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.reflection.ProxyFactory"
+    constructor="stoc_FactoryImpl_get_implementation">
     <service name="com.sun.star.reflection.ProxyFactory"/>
   </implementation>
 </component>
diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx
index 9c3afd927d03..cecb6d917b39 100644
--- a/stoc/source/proxy_factory/proxyfac.cxx
+++ b/stoc/source/proxy_factory/proxyfac.cxx
@@ -30,16 +30,12 @@
 #include <typelib/typedescription.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/implbase.hxx>
-#include <cppuhelper/implementationentry.hxx>
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/weakagg.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/reflection/XProxyFactory.hpp>
 #include <com/sun/star/uno/RuntimeException.hpp>
-
-#define SERVICE_NAME "com.sun.star.reflection.ProxyFactory"
-#define IMPL_NAME "com.sun.star.comp.reflection.ProxyFactory"
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 
 using namespace ::com::sun::star;
@@ -49,17 +45,6 @@ using namespace css::uno;
 namespace
 {
 
-OUString proxyfac_getImplementationName()
-{
-    return IMPL_NAME;
-}
-
-Sequence< OUString > proxyfac_getSupportedServiceNames()
-{
-    return { SERVICE_NAME };
-}
-
-
 struct FactoryImpl : public ::cppu::WeakImplHelper< lang::XServiceInfo,
                                                      reflection::XProxyFactory >
 {
@@ -399,7 +384,7 @@ Reference< XAggregation > FactoryImpl::createProxy(
 
 OUString FactoryImpl::getImplementationName()
 {
-    return proxyfac_getImplementationName();
+    return "com.sun.star.comp.reflection.ProxyFactory";
 }
 
 sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
@@ -409,12 +394,12 @@ sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
 
 Sequence< OUString > FactoryImpl::getSupportedServiceNames()
 {
-    return proxyfac_getSupportedServiceNames();
+    return { "com.sun.star.reflection.ProxyFactory" };
 }
 
-/// @throws Exception
-Reference< XInterface > proxyfac_create(
-    SAL_UNUSED_PARAMETER Reference< XComponentContext > const & )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+stoc_FactoryImpl_get_implementation(
+    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
     Reference< XInterface > xRet;
     static osl::Mutex s_mutex;
@@ -429,26 +414,11 @@ Reference< XInterface > proxyfac_create(
         xRet = static_cast< ::cppu::OWeakObject * >(new FactoryImpl);
         rwInstance = xRet;
     }
-    return xRet;
+    xRet->acquire();
+    return xRet.get();
 }
 
-const ::cppu::ImplementationEntry g_entries [] =
-{
-    {
-        proxyfac_create, proxyfac_getImplementationName,
-        proxyfac_getSupportedServiceNames, ::cppu::createSingleComponentFactory,
-        nullptr, 0
-    },
-    { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
 
 }
 
-extern "C" SAL_DLLPUBLIC_EXPORT void * proxyfac_component_getFactory(
-    const char * pImplName, void * pServiceManager, void * pRegistryKey )
-{
-    return ::cppu::component_getFactoryHelper(
-        pImplName, pServiceManager, pRegistryKey, g_entries );
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list