Kaydet (Commit) 901999ae authored tarafından Henry Castro's avatar Henry Castro

cppuhelper: add loadImplementations

pre-load all C++ component library.

Change-Id: I95637b628c5a6340afce09b2d2033127c6f8f504
üst 419ae0c8
......@@ -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: */
......@@ -423,6 +423,7 @@ global:
# enableChangeListenerNotification
_ZN4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
_ZThn*_N4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
_ZN4cppu16preInitBootstrapEv;
} UDK_3.7;
LIBO_UDK_3.9 { # LibO 3.7
......
......@@ -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;
......
......@@ -203,6 +203,8 @@ public:
css::uno::Reference< css::uno::XComponentContext > const & context,
boost::shared_ptr< Data::Implementation > & implementation);
void loadImplementations();
private:
virtual ~ServiceManager() {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment