Kaydet (Commit) 799aef2b authored tarafından Michael Meeks's avatar Michael Meeks

preload: cleanup disabled messages and simplify flow.

Change-Id: I249b81afe5ec2fab5e0aaf73a2cde62173fa803e
Reviewed-on: https://gerrit.libreoffice.org/69912
Tested-by: Jenkins
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst db76236e
...@@ -1790,7 +1790,7 @@ void cppuhelper::ServiceManager::preloadImplementations() { ...@@ -1790,7 +1790,7 @@ void cppuhelper::ServiceManager::preloadImplementations() {
std::cerr << "preload:"; std::cerr << "preload:";
std::vector<OUString> aReported; std::vector<OUString> aReported;
std::vector<OUString> aDisabled; std::vector<OUString> aDisabled;
OUStringBuffer aDisabledMsg("Disabled: "); OUStringBuffer aDisabledMsg;
/// Allow external callers & testers to disable certain components /// Allow external callers & testers to disable certain components
const char *pDisable = getenv("UNODISABLELIBRARY"); const char *pDisable = getenv("UNODISABLELIBRARY");
...@@ -1809,6 +1809,10 @@ void cppuhelper::ServiceManager::preloadImplementations() { ...@@ -1809,6 +1809,10 @@ void cppuhelper::ServiceManager::preloadImplementations() {
// loop all implementations // loop all implementations
for (const auto& rEntry : data_.namedImplementations) for (const auto& rEntry : data_.namedImplementations)
{ {
if (rEntry.second->info->loader != "com.sun.star.loader.SharedLibrary" ||
rEntry.second->status == Data::Implementation::STATUS_LOADED)
continue;
try try
{ {
const OUString &aLibrary = rEntry.second->info->uri; const OUString &aLibrary = rEntry.second->info->uri;
...@@ -1848,9 +1852,6 @@ void cppuhelper::ServiceManager::preloadImplementations() { ...@@ -1848,9 +1852,6 @@ void cppuhelper::ServiceManager::preloadImplementations() {
static_cast< cppu::OWeakObject * >(this)); static_cast< cppu::OWeakObject * >(this));
} }
if (rEntry.second->info->loader == "com.sun.star.loader.SharedLibrary" &&
rEntry.second->status != Data::Implementation::STATUS_LOADED)
{
// load component library // load component library
osl::Module aModule(aUri, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL); osl::Module aModule(aUri, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL);
...@@ -1902,14 +1903,8 @@ void cppuhelper::ServiceManager::preloadImplementations() { ...@@ -1902,14 +1903,8 @@ void cppuhelper::ServiceManager::preloadImplementations() {
{ {
// get function symbol component factory // get function symbol component factory
aTargetEnv = cppuhelper::detail::getEnvironment(rEntry.second->info->environment, rEntry.second->info->name); aTargetEnv = cppuhelper::detail::getEnvironment(rEntry.second->info->environment, rEntry.second->info->name);
if (aSourceEnv.get() == aTargetEnv.get()) fpFactory = (aSourceEnv.get() == aTargetEnv.get()) ?
{ aModule.getFunctionSymbol(rEntry.second->info->constructor) : nullptr;
fpFactory = aModule.getFunctionSymbol(rEntry.second->info->constructor);
}
else
{
fpFactory = nullptr;
}
} }
css::uno::Reference<css::lang::XSingleComponentFactory> xSCFactory; css::uno::Reference<css::lang::XSingleComponentFactory> xSCFactory;
...@@ -1923,14 +1918,12 @@ void cppuhelper::ServiceManager::preloadImplementations() { ...@@ -1923,14 +1918,12 @@ void cppuhelper::ServiceManager::preloadImplementations() {
{ {
xSSFactory.set(xFactory, css::uno::UNO_QUERY); xSSFactory.set(xFactory, css::uno::UNO_QUERY);
if (!xSSFactory.is()) if (!xSSFactory.is())
{
throw css::uno::DeploymentException( throw css::uno::DeploymentException(
("Implementation " + rEntry.second->info->name ("Implementation " + rEntry.second->info->name
+ " does not provide a constructor or factory"), + " does not provide a constructor or factory"),
static_cast< cppu::OWeakObject * >(this)); static_cast< cppu::OWeakObject * >(this));
} }
} }
}
if (!rEntry.second->info->constructor.isEmpty() && fpFactory) if (!rEntry.second->info->constructor.isEmpty() && fpFactory)
rEntry.second->constructor = WrapperConstructorFn(reinterpret_cast<ImplementationConstructorFn *>(fpFactory)); rEntry.second->constructor = WrapperConstructorFn(reinterpret_cast<ImplementationConstructorFn *>(fpFactory));
...@@ -1956,10 +1949,13 @@ void cppuhelper::ServiceManager::preloadImplementations() { ...@@ -1956,10 +1949,13 @@ void cppuhelper::ServiceManager::preloadImplementations() {
// leak aModule // leak aModule
aModule.release(); aModule.release();
} }
}
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << aDisabledMsg.makeStringAndClear() << "\n"; if (aDisabledMsg.getLength() > 0)
{
OUString aMsg = aDisabledMsg.makeStringAndClear();
std::cerr << "Disabled: " << aMsg << "\n";
}
std::cerr.flush(); std::cerr.flush();
// Various rather important uno mappings. // Various rather important uno mappings.
......
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