diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-01-28 18:31:03 -0500 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2016-03-20 21:59:39 +0200 |
commit | 8e824a59965906077f1d1c39c5afa73b9fc4d650 (patch) | |
tree | ecdb769a53ac3af4ca4555256312f3ef4d02582c /cppuhelper/source | |
parent | 3cbdfeeb2b1765d6399ae7656a7b9ff91290bb7b (diff) |
Restoring preinit
Change-Id: I65341c57d00308d246ec90deab8050b2c4bb3e61
(cherry picked from commit 62a2d525a7db09c7223a21907e1a0f4989398c15)
Diffstat (limited to 'cppuhelper/source')
-rw-r--r-- | cppuhelper/source/defaultbootstrap.cxx | 17 | ||||
-rw-r--r-- | cppuhelper/source/gcc3.map | 1 | ||||
-rw-r--r-- | cppuhelper/source/servicemanager.cxx | 35 | ||||
-rw-r--r-- | cppuhelper/source/servicemanager.hxx | 2 |
4 files changed, 55 insertions, 0 deletions
diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx index 1fbbf8f541fc..b135b2c9dc89 100644 --- a/cppuhelper/source/defaultbootstrap.cxx +++ b/cppuhelper/source/defaultbootstrap.cxx @@ -43,6 +43,18 @@ rtl::OUString getBootstrapVariable( return v; } +void default_preInitBootstrap(rtl::OUString const & aUri) +{ + rtl::Bootstrap bsUri(aUri); + if (bsUri.getHandle() == 0) + throw css::uno::DeploymentException("Cannot open uno ini " + aUri); + + // create the service manager + rtl::Reference< cppuhelper::ServiceManager > aManager(new cppuhelper::ServiceManager); + // read rdb files + aManager->init(getBootstrapVariable(bsUri, "UNO_SERVICES")); + aManager->loadImplementations(); +} } css::uno::Reference< css::uno::XComponentContext > @@ -107,4 +119,9 @@ cppu::defaultBootstrap_InitialComponentContext() return defaultBootstrap_InitialComponentContext(getUnoIniUri()); } +void +cppu::preInitBootstrap() +{ + default_preInitBootstrap(getUnoIniUri()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map index 12c29834ab16..3d7a5c66cdf0 100644 --- a/cppuhelper/source/gcc3.map +++ b/cppuhelper/source/gcc3.map @@ -423,6 +423,7 @@ global: # enableChangeListenerNotification _ZN4cppu19OPropertySetHelper232enableChangeListenerNotificationEh; _ZThn*_N4cppu19OPropertySetHelper232enableChangeListenerNotificationEh; + _ZN4cppu16preInitBootstrapEv; } UDK_3.7; LIBO_UDK_3.9 { # LibO 3.7 diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 2140a2f74f07..ffed6baaff8c 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -42,6 +42,7 @@ #include <rtl/strbuf.hxx> #include <sal/log.hxx> #include <uno/environment.hxx> +#include <osl/module.hxx> #include "loadsharedlibcomponentfactory.hxx" @@ -878,6 +879,40 @@ void cppuhelper::ServiceManager::loadImplementation( } } +void cppuhelper::ServiceManager::loadImplementations() +{ + rtl::OUString aUri; + osl::MutexGuard g(rBHelper.rMutex); + + for (Data::NamedImplementations::const_iterator iterator( + data_.namedImplementations.begin()); + iterator != data_.namedImplementations.end(); ++iterator) + { + try + { + aUri = cppu::bootstrap_expandUri(iterator->second->info->uri); + } + catch (css::lang::IllegalArgumentException& aError) + { + throw css::uno::DeploymentException( + "Cannot expand URI" + iterator->second->info->uri + ": " + aError.Message, + static_cast< cppu::OWeakObject * >(this)); + } + + if (iterator->second->info->loader == "com.sun.star.loader.SharedLibrary" && + iterator->second->status != Data::Implementation::STATUS_LOADED) + { + oslModule aModule = osl_loadModule( aUri.pData, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL ); + SAL_INFO("lok", "loaded component library " << aUri << ( aModule ? " ok" : " no")); + + // leak aModule + // osl_unloadModule(aModule); + if ( aModule ) + iterator->second->status = Data::Implementation::STATUS_LOADED; + } + } +} + void cppuhelper::ServiceManager::disposing() { std::vector< css::uno::Reference<css::lang::XComponent> > sngls; std::vector< css::uno::Reference< css::lang::XComponent > > comps; diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx index 903084b11eef..ddf85965fda2 100644 --- a/cppuhelper/source/servicemanager.hxx +++ b/cppuhelper/source/servicemanager.hxx @@ -203,6 +203,8 @@ public: css::uno::Reference< css::uno::XComponentContext > const & context, boost::shared_ptr< Data::Implementation > & implementation); + void loadImplementations(); + private: virtual ~ServiceManager() {} |