summaryrefslogtreecommitdiff
path: root/cppuhelper/source
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2017-11-24 17:05:26 +0000
committerMichael Meeks <michael.meeks@collabora.com>2017-11-25 11:10:14 +0100
commit1aedb6c4345719a963a883b13fa983db3ab4b9a8 (patch)
tree7fa713a904ed1d4647b6d55af813a5a01d8773c9 /cppuhelper/source
parent6481a06b066a744e4f1a41ce1b0ca8b27e5f39b4 (diff)
LOK: provide user feedback while preloading.
Problems are hard enough to debug in a jailed kit process inside a docker image; provide some visual feedback via stderr. Change-Id: I54b0a21c1375be2acc9da0bbacf959a419471b08 Reviewed-on: https://gerrit.libreoffice.org/45256 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'cppuhelper/source')
-rw-r--r--cppuhelper/source/servicemanager.cxx42
1 files changed, 41 insertions, 1 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 8aa294ca0720..163e0e631d37 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -10,6 +10,7 @@
#include <sal/config.h>
#include <algorithm>
+#include <iostream>
#include <cassert>
#include <vector>
@@ -39,6 +40,7 @@
#include <rtl/uri.hxx>
#include <rtl/ustring.hxx>
#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <uno/environment.hxx>
@@ -1806,6 +1808,33 @@ cppuhelper::ServiceManager::findServiceImplementation(
return impl;
}
+/// Make a simpler unique name for preload / progress reporting.
+static rtl::OUString simplifyModule(const rtl::OUString &uri)
+{
+ sal_Int32 nIdx;
+ OUStringBuffer edit(uri);
+ if ((nIdx = edit.lastIndexOf('/')) > 0)
+ edit.remove(0,nIdx+1);
+ if ((nIdx = edit.lastIndexOf(':')) > 0)
+ edit.remove(0,nIdx+1);
+ if ((nIdx = edit.lastIndexOf("lo.so")) > 0)
+ edit.truncate(nIdx);
+ if ((nIdx = edit.lastIndexOf(".3")) > 0)
+ edit.truncate(nIdx);
+ if ((nIdx = edit.lastIndexOf("gcc3.so")) > 0)
+ edit.truncate(nIdx);
+ if ((nIdx = edit.lastIndexOf(".so")) > 0)
+ edit.truncate(nIdx);
+ if ((nIdx = edit.lastIndexOf("_uno")) > 0)
+ edit.truncate(nIdx);
+ if ((nIdx = edit.lastIndexOf(".jar")) > 0)
+ edit.truncate(nIdx);
+ if (edit.indexOf("lib") == 0)
+ edit.remove(0,3);
+ return edit.makeStringAndClear();
+}
+
+/// Used only by LibreOfficeKit when used by Online to pre-initialize
void cppuhelper::ServiceManager::preloadImplementations() {
#ifdef DISABLE_DYNLOADING
abort();
@@ -1814,6 +1843,9 @@ void cppuhelper::ServiceManager::preloadImplementations() {
osl::MutexGuard g(rBHelper.rMutex);
css::uno::Environment aSourceEnv(css::uno::Environment::getCurrent());
+ std::cerr << "preload: ";
+ std::vector<OUString> aReported;
+
// loop all implementations
for (Data::NamedImplementations::const_iterator iterator(
data_.namedImplementations.begin());
@@ -1821,8 +1853,15 @@ void cppuhelper::ServiceManager::preloadImplementations() {
{
try
{
+ const rtl::OUString &aLibrary = iterator->second->info->uri;
+ if (std::find(aReported.begin(), aReported.end(), aLibrary) == aReported.end())
+ {
+ std::cerr << simplifyModule(aLibrary) << " ";
+ aReported.push_back(aLibrary);
+ }
+
// expand absolute URI implementation component library
- aUri = cppu::bootstrap_expandUri(iterator->second->info->uri);
+ aUri = cppu::bootstrap_expandUri(aLibrary);
}
catch (css::lang::IllegalArgumentException& aError)
{
@@ -1922,6 +1961,7 @@ void cppuhelper::ServiceManager::preloadImplementations() {
aModule.release();
}
}
+ std::cerr << std::endl;
#endif
}