diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2017-11-24 17:05:26 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2017-11-25 11:10:14 +0100 |
commit | 1aedb6c4345719a963a883b13fa983db3ab4b9a8 (patch) | |
tree | 7fa713a904ed1d4647b6d55af813a5a01d8773c9 | |
parent | 6481a06b066a744e4f1a41ce1b0ca8b27e5f39b4 (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>
-rw-r--r-- | cppuhelper/source/servicemanager.cxx | 42 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 9 |
2 files changed, 47 insertions, 4 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 } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 42e78e8bec96..5d0e39c419cc 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -14,6 +14,7 @@ #include <stdlib.h> #include <memory> +#include <iostream> #include <boost/property_tree/json_parser.hpp> #include <LibreOfficeKit/LibreOfficeKit.h> @@ -3482,6 +3483,7 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit: } } +/// Used only by LibreOfficeKit when used by Online to pre-initialize static void preloadData() { // First: sit down and read all dictionaries: yum. @@ -3491,14 +3493,14 @@ static void preloadData() css::uno::Reference<linguistic2::XSupportedLocales> xLocales(xSpellChecker, css::uno::UNO_QUERY_THROW); uno::Sequence< css::lang::Locale > aLocales = xLocales->getLocales(); - SAL_INFO("lok", "Preloading #" << aLocales.getLength() << " dictionaries"); + std::cerr << "Preloading dictionaries: "; for (auto &it : aLocales) { - SAL_INFO("lok", " load " << it.Language << "_" << it.Country); + std::cerr << it.Language << "_" << it.Country << " "; css::beans::PropertyValues aNone; xSpellChecker->isValid("forcefed", it, aNone); } - SAL_INFO("lok", "Preloading done"); + std::cerr << "\n"; } static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfileUrl) @@ -3596,6 +3598,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char if (eStage == PRE_INIT) { + std::cerr << "Init vcl\n"; InitVCL(); // pre-load all component libraries. |