[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - cppuhelper/source desktop/source

Michael Meeks michael.meeks at collabora.com
Thu Nov 30 16:28:57 UTC 2017


 cppuhelper/source/servicemanager.cxx |   42 ++++++++++++++++++++++++++++++++++-
 desktop/source/lib/init.cxx          |    9 +++++--
 2 files changed, 47 insertions(+), 4 deletions(-)

New commits:
commit c854d3f13ee14b194ffe859f605a6c1ad1c3b297
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Nov 24 17:05:26 2017 +0000

    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 at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

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.


More information about the Libreoffice-commits mailing list