summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2017-11-24 17:05:26 +0000
committerJan Holesovsky <kendy@collabora.com>2017-11-30 17:28:25 +0100
commitc854d3f13ee14b194ffe859f605a6c1ad1c3b297 (patch)
tree0348a851ad535a9baaf0ed7d65ff5cdc9651796d
parentf25e0008a0a18c4894891587337a204805173e0c (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/45465 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--cppuhelper/source/servicemanager.cxx42
-rw-r--r--desktop/source/lib/init.cxx9
2 files changed, 47 insertions, 4 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 22411286a2b7..0b2e5c0f668f 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>
@@ -40,6 +41,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>
@@ -1906,6 +1908,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();
@@ -1914,6 +1943,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());
@@ -1921,8 +1953,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)
{
@@ -2014,6 +2053,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 b382aa507290..62e2def43b8f 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>
@@ -3550,6 +3551,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.
@@ -3559,14 +3561,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)
@@ -3658,6 +3660,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.