[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 6 commits - desktop/source solenv/bin vcl/android vcl/headless vcl/inc vcl/source

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Sat May 9 08:43:12 UTC 2020


 desktop/source/lib/init.cxx     |   21 +++++++-
 solenv/bin/native-code.py       |   12 ++++
 vcl/android/androidinst.cxx     |   17 +++++++
 vcl/headless/svpgdi.cxx         |   97 ++++++++++++++++++++++++++--------------
 vcl/inc/android/androidinst.hxx |    3 +
 vcl/inc/salinst.hxx             |    3 +
 vcl/source/app/svapp.cxx        |    5 ++
 vcl/source/window/toolbox2.cxx  |    6 ++
 8 files changed, 128 insertions(+), 36 deletions(-)

New commits:
commit 9a38b194eec5bcf6cb8d073e5d35173c5856f28f
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Jan 6 21:56:20 2020 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat May 9 09:37:07 2020 +0100

    android: avoid expensive load of un-used sidebar icons on mobile.
    
    Change-Id: I34c24c40009eeb4e8edbac785f9367f1dc3d56c1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86468
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 95813d97e4e8..b3313518ab69 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -20,6 +20,7 @@
 #include <sal/config.h>
 #include <sal/log.hxx>
 
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <boost/property_tree/ptree.hpp>
 
@@ -425,7 +426,12 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css
     auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rCommand, aModuleName);
     OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
     OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, aProperties, rFrame));
+
+#ifdef ANDROID
+    Image aImage; // Loading redundant icons for sidebars shows in profiles.
+#else
     Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame, GetImageSize()));
+#endif
 
     sal_uInt16 nItemId = GetItemCount() + 1;
         //TODO: ImplToolItems::size_type -> sal_uInt16!
commit 8bfcba5d8ef4e10a99082d643232a9a6f99d07b3
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Jan 6 20:49:40 2020 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat May 9 09:36:38 2020 +0100

    tdf#129845 vcl: avoid expensive system caching of trivial lines & polygons
    
    Interestingly the cache map lookup is rather expensive; why:
    
    polyline output for some trivial impress edits:
            count   # of polylines
            2       2134
            3       141
            4       41
            9       4
    
    polypolygon output for some trivial impress edits:
    
            count   # of polypolygons       geometry.
            3       54    all single polygon
            4       583   ~all single
            9       52    ~ all paired with a 4 node polygon
            13      2     both single
            32      22    all single
    
    Change-Id: I15c0053a84399eaf153b2119b2c28d1f168f16b1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86314
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 7b2286d6d9a5..b6f59a29d6be 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -117,6 +117,18 @@ namespace
         aDamageRect.intersect(getClipBox(cr));
         return aDamageRect;
     }
+
+    // The caching logic is surprsingly expensive - so avoid it sometimes.
+    inline bool isTrivial(const basegfx::B2DPolyPolygon& rPolyPolygon)
+    {
+        return rPolyPolygon.count() == 1 && rPolyPolygon.begin()->count() <= 4;
+    }
+
+    // The caching logic is surprsingly expensive - so avoid it sometimes.
+    inline bool isTrivial(const basegfx::B2DPolygon& rPolyLine)
+    {
+        return rPolyLine.count() <= 4;
+    }
 }
 
 bool SvpSalGraphics::blendBitmap( const SalTwoRect&, const SalBitmap& /*rBitmap*/ )
@@ -1273,29 +1285,37 @@ bool SvpSalGraphics::drawPolyLine(
     cairo_set_line_width(cr, aLineWidths.getX());
     cairo_set_miter_limit(cr, fMiterLimit);
 
-    // try to access buffered data
-    std::shared_ptr<SystemDependentData_CairoPath> pSystemDependentData_CairoPath(
-        rPolyLine.getSystemDependentData<SystemDependentData_CairoPath>());
+    bool bDone = false;
+    bool bIsTrivial = isTrivial(rPolyLine);
 
-    if(pSystemDependentData_CairoPath)
+    if (!bIsTrivial)
     {
-        // check data validity
-        if(nullptr == pSystemDependentData_CairoPath->getCairoPath()
-            || pSystemDependentData_CairoPath->getNoJoin() != bNoJoin
-            || pSystemDependentData_CairoPath->getAntiAliasB2DDraw() != bAntiAliasB2DDraw
-            || bPixelSnapHairline /*tdf#124700*/ )
+        // try to access buffered data
+        std::shared_ptr<SystemDependentData_CairoPath> pSystemDependentData_CairoPath(
+            rPolyLine.getSystemDependentData<SystemDependentData_CairoPath>());
+
+        if(pSystemDependentData_CairoPath)
         {
-            // data invalid, forget
-            pSystemDependentData_CairoPath.reset();
+            // check data validity
+            if(nullptr == pSystemDependentData_CairoPath->getCairoPath()
+               || pSystemDependentData_CairoPath->getNoJoin() != bNoJoin
+               || pSystemDependentData_CairoPath->getAntiAliasB2DDraw() != bAntiAliasB2DDraw
+               || bPixelSnapHairline /*tdf#124700*/ )
+            {
+                // data invalid, forget
+                pSystemDependentData_CairoPath.reset();
+            }
         }
-    }
 
-    if(pSystemDependentData_CairoPath)
-    {
-        // re-use data
-        cairo_append_path(cr, pSystemDependentData_CairoPath->getCairoPath());
+        if(pSystemDependentData_CairoPath)
+        {
+            // re-use data
+            cairo_append_path(cr, pSystemDependentData_CairoPath->getCairoPath());
+            bDone = true;
+        }
     }
-    else
+
+    if (!bDone)
     {
         // create data
         if (!bNoJoin)
@@ -1338,9 +1358,9 @@ bool SvpSalGraphics::drawPolyLine(
         }
 
         // copy and add to buffering mechanism
-        if (!bPixelSnapHairline /*tdf#124700*/)
+        if (!bIsTrivial && !bPixelSnapHairline /*tdf#124700*/)
         {
-            pSystemDependentData_CairoPath = rPolyLine.addOrReplaceSystemDependentData<SystemDependentData_CairoPath>(
+            rPolyLine.addOrReplaceSystemDependentData<SystemDependentData_CairoPath>(
                 ImplGetSystemDependentDataManager(),
                 cairo_copy_path(cr),
                 bNoJoin,
@@ -1391,16 +1411,24 @@ namespace
 {
     void add_polygon_path(cairo_t* cr, const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DHomMatrix& rObjectToDevice, bool bPixelSnap)
     {
-        // try to access buffered data
-        std::shared_ptr<SystemDependentData_CairoPath> pSystemDependentData_CairoPath(
-            rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPath>());
+        bool bDone = false;
+        bool bIsTrivial = isTrivial(rPolyPolygon);
 
-        if(pSystemDependentData_CairoPath)
+        if (!bIsTrivial)
         {
-            // re-use data
-            cairo_append_path(cr, pSystemDependentData_CairoPath->getCairoPath());
+            // try to access buffered data
+            std::shared_ptr<SystemDependentData_CairoPath> pSystemDependentData_CairoPath(
+                rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPath>());
+
+            if(pSystemDependentData_CairoPath)
+            {
+                // re-use data
+                cairo_append_path(cr, pSystemDependentData_CairoPath->getCairoPath());
+                bDone = true;
+            }
         }
-        else
+
+        if (!bDone)
         {
             // create data
             for (const auto & rPoly : rPolyPolygon)
@@ -1415,13 +1443,16 @@ namespace
                     false);
             }
 
-            // copy and add to buffering mechanism
-            // for decisions how/what to buffer, see Note in WinSalGraphicsImpl::drawPolyPolygon
-            pSystemDependentData_CairoPath = rPolyPolygon.addOrReplaceSystemDependentData<SystemDependentData_CairoPath>(
-                ImplGetSystemDependentDataManager(),
-                cairo_copy_path(cr),
-                false,
-                false);
+            if (!bIsTrivial)
+            {
+                // copy and add to buffering mechanism
+                // for decisions how/what to buffer, see Note in WinSalGraphicsImpl::drawPolyPolygon
+                rPolyPolygon.addOrReplaceSystemDependentData<SystemDependentData_CairoPath>(
+                    ImplGetSystemDependentDataManager(),
+                    cairo_copy_path(cr),
+                    false,
+                    false);
+            }
         }
     }
 }
commit 23fa8aec0bc88e5a1bdf44a56af354bb620edad7
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Dec 19 11:09:02 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat May 9 09:34:38 2020 +0100

    mobile: add missing chart & calc sidebar panels.
    
    Amazing that these were missing.
    
    Change-Id: Ic5f22dfa80169630badd5834632b8632922cd04b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86087
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 6ecc72c6acd1..79a0987b5059 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -122,6 +122,7 @@ core_constructor_list = [
     "com_sun_star_comp_chart2_ChartDocumentWrapper_get_implementation",
     "com_sun_star_comp_chart2_ChartFrameLoader_get_implementation",
     "com_sun_star_comp_chart2_WizardDialog_get_implementation",
+    "org_libreoffice_comp_chart2_sidebar_ChartPanelFactory",
 # comphelper/util/comphelp.component
     "com_sun_star_comp_MemoryStream",
     "com_sun_star_comp_task_OfficeRestartManager",
@@ -381,6 +382,8 @@ calc_factory_list = [
 calc_constructor_list = [
 # avmedia/util/avmedia.component
     "com_sun_star_comp_framework_SoundHandler_get_implementation",
+# sc/util/sc.component
+    "ScPanelFactory_get_implementation",
 # sc/util/scd.component
     "com_sun_star_comp_calc_ExcelBiffFormatDetector_get_implementation",
     "com_sun_star_comp_calc_FormatDetector_get_implementation",
commit ce018c6769fb06344877ce09720f13689f52a616
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Dec 18 13:30:23 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat May 9 09:34:02 2020 +0100

    mobile: add components needed for long-press context menu popups.
    
    Change-Id: Id0d3c4216122cc1d91d082bbaca308fe844951de
    Reviewed-on: https://gerrit.libreoffice.org/85386
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit 1be7094e8854b6d10db1d6ca4f4f940572a7722d)
    Reviewed-on: https://gerrit.libreoffice.org/85685
    Tested-by: Jenkins
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 09b4b50712af..6ecc72c6acd1 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -167,12 +167,19 @@ core_constructor_list = [
     "com_sun_star_comp_framework_Frame_get_implementation",
     "com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation",
     "com_sun_star_comp_framework_JobExecutor_get_implementation",
+    "com_sun_star_comp_framework_jobs_JobDispatch_get_implementation",
     "com_sun_star_comp_framework_LayoutManager_get_implementation",
     "com_sun_star_comp_framework_ModuleManager_get_implementation",
     "com_sun_star_comp_framework_ModuleUIConfigurationManager_get_implementation",
     "com_sun_star_comp_framework_ModuleUIConfigurationManagerSupplier_get_implementation",
     "com_sun_star_comp_framework_PathSettings_get_implementation",
     "com_sun_star_comp_framework_PathSubstitution_get_implementation",
+    "com_sun_star_comp_framework_ObjectMenuController_get_implementation",
+    "com_sun_star_comp_framework_PopupMenuControllerFactory_get_implementation",
+    "com_sun_star_comp_framework_ControlMenuController_get_implementation",
+    "com_sun_star_comp_framework_ThesaurusMenuController_get_implementation",
+    "com_sun_star_comp_framework_ToolbarAsMenuController_get_implementation",
+    "com_sun_star_comp_framework_ResourceMenuController_get_implementation",
     "com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation",
     "com_sun_star_comp_framework_TaskCreator_get_implementation",
     "com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation",
@@ -226,6 +233,7 @@ core_constructor_list = [
     "com_sun_star_comp_graphic_GraphicProvider_get_implementation",
 # svx/util/svx.component
     "com_sun_star_comp_svx_NumberingToolBoxControl_get_implementation",
+    "com_sun_star_comp_svx_SmartTagMenuController_get_implementation",
     "com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation",
     "com_sun_star_drawing_SvxShapeCollection_get_implementation",
     "com_sun_star_svx_FontHeightToolBoxController_get_implementation",
@@ -259,6 +267,7 @@ core_constructor_list = [
     "stardiv_Toolkit_UnoDateFieldControl_get_implementation",
     "stardiv_Toolkit_UnoSpinButtonModel_get_implementation",
     "stardiv_Toolkit_VCLXPointer_get_implementation",
+    "stardiv_Toolkit_VCLXPopupMenu_get_implementation",
     "stardiv_Toolkit_VCLXToolkit_get_implementation",
 # uui/util/uui.component
     "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation",
commit f3feb1ec785b19925a4ea79fd49813a4171f2fb2
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Dec 11 14:38:43 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat May 9 09:33:26 2020 +0100

    android: add abstraction to allow us to DetachThread sensibly.
    
    If we fail to do this after runLoop - some Android VMs can get really
    upset if we quit a thread without doing this, also ensure that we
    AttachThread to new polling loop threads as we come in for good
    measure - duplicate Attach's are NOPs.
    
    Change-Id: I32454773af4e02c97df0b6c02f61b1dc74df80b0
    Reviewed-on: https://gerrit.libreoffice.org/84956
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 7241382ccc0a028c5f08304090a6344e582db068)
    Reviewed-on: https://gerrit.libreoffice.org/84969
    Tested-by: Jenkins

diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index d8f234ccc7f5..ddc6e92d55f3 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -57,10 +57,12 @@ AndroidSalInstance *AndroidSalInstance::getInstance()
 AndroidSalInstance::AndroidSalInstance( std::unique_ptr<SalYieldMutex> pMutex )
     : SvpSalInstance( std::move(pMutex) )
 {
+    // FIXME: remove when uniPoll & runLoop is the only android entry poit.
     int res = (lo_get_javavm())->AttachCurrentThread(&m_pJNIEnv, NULL);
     LOGI("AttachCurrentThread res=%d env=%p", res, m_pJNIEnv);
 }
 
+// This is never called on Android until app exit.
 AndroidSalInstance::~AndroidSalInstance()
 {
     int res = (lo_get_javavm())->DetachCurrentThread();
@@ -78,6 +80,21 @@ bool AndroidSalInstance::AnyInput( VclInputFlags nType )
     return SvpSalInstance::s_pDefaultInstance->HasUserEvents();
 }
 
+void AndroidSalInstance::updateMainThread()
+{
+    int res = (lo_get_javavm())->AttachCurrentThread(&m_pJNIEnv, NULL);
+    LOGI("updateMainThread AttachCurrentThread res=%d env=%p", res, m_pJNIEnv);
+    SvpSalInstance::updateMainThread();
+}
+
+void AndroidSalInstance::releaseMainThread()
+{
+    int res = (lo_get_javavm())->DetachCurrentThread();
+    LOGI("releaseMainThread DetachCurrentThread res=%d", res);
+
+    SvpSalInstance::releaseMainThread();
+}
+
 class AndroidSalSystem : public SvpSalSystem {
 public:
     AndroidSalSystem() : SvpSalSystem() {}
diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx
index 49758f3efd70..526174b14951 100644
--- a/vcl/inc/android/androidinst.hxx
+++ b/vcl/inc/android/androidinst.hxx
@@ -38,6 +38,9 @@ public:
 
     // mainloop pieces
     virtual bool AnyInput( VclInputFlags nType );
+
+    virtual void updateMainThread();
+    virtual void releaseMainThread();
 };
 
 #endif // INCLUDED_VCL_INC_ANDROID_ANDROIDINST_HXX
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index f8935baf218a..c9c0fcccdc0e 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -196,7 +196,10 @@ public:
     virtual void            jobStartedPrinterUpdate() {}
     virtual void            jobEndedPrinterUpdate() {}
 
+    /// Set the app's (somewhat) magic/main-thread to this one.
     virtual void            updateMainThread() {}
+    /// Disconnect that - good for detatching from the JavaVM on Android.
+    virtual void            releaseMainThread() {}
 
     /// get information about underlying versions
     virtual OUString        getOSVersion() { return "-"; }
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index c4c3be9699e3..988fdb01aaaf 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1644,6 +1644,11 @@ void unregisterPollCallbacks()
     ImplSVData * pSVData = ImplGetSVData();
     if (pSVData)
     {
+        // Not hyper-elegant - but in the case of Android & unipoll we need to detach
+        // this thread from the JVM's clutches to avoid a crash closing document
+        if (pSVData->mpPollClosure && pSVData->mpDefInst)
+            pSVData->mpDefInst->releaseMainThread();
+
         // Just set mpPollClosure to null as that is what calling this means, that the callback data
         // points to an object that no longer exists. In particular, don't set
         // pSVData->mpPollCallback to nullptr as that is used to detect whether Unipoll is in use in
commit 3830053a76401e9219047cc3aaa2d63070e9ac19
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Dec 18 13:31:58 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat May 9 09:32:16 2020 +0100

    lok: catch and log exceptions during key / mouse event emission.
    
    Change-Id: I2be8219f6b2648f3f0192caeccf8e8b037634dc2
    Reviewed-on: https://gerrit.libreoffice.org/85387
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit 46fbc12dac86579708695fddeaf4a3a2f8098955)
    Reviewed-on: https://gerrit.libreoffice.org/85684
    Tested-by: Jenkins
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 622a94351edb..324467a586e5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3073,7 +3073,15 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar
         return;
     }
 
-    pDoc->postKeyEvent(nType, nCharCode, nKeyCode);
+    try
+    {
+        pDoc->postKeyEvent(nType, nCharCode, nKeyCode);
+    }
+    catch (const uno::Exception& exception)
+    {
+        SetLastExceptionMsg(exception.Message);
+        SAL_INFO("lok", "Failed to postKeyEvent " << exception.Message);
+    }
 }
 
 static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsigned nWindowId, int nType, const char* pText)
@@ -3537,8 +3545,15 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX,
         SetLastExceptionMsg("Document doesn't support tiled rendering");
         return;
     }
-
-    pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier);
+    try
+    {
+        pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier);
+    }
+    catch (const uno::Exception& exception)
+    {
+        SetLastExceptionMsg(exception.Message);
+        SAL_INFO("lok", "Failed to postMouseEvent " << exception.Message);
+    }
 }
 
 static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)


More information about the Libreoffice-commits mailing list