[Libreoffice-commits] core.git: vcl/inc vcl/skia

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 29 07:57:24 UTC 2020


 vcl/inc/skia/zone.hxx |    3 +++
 vcl/skia/README       |    9 +++++++++
 2 files changed, 12 insertions(+)

New commits:
commit 7c1dc527837a65b77f7624e18a575271cb46afba
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Sep 10 20:20:25 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Sep 29 09:56:49 2020 +0200

    ensure SolarMutex is held for SkiaZone
    
    This is simply being lazy and requiring the mutex held for all Skia
    operations. With the effort to verify things it'd presumably be
    possible to make the code thread-safe.
    
    Change-Id: I748dbf2d5af66dcd140b5a9d6d57e9d848babf0e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103564
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/inc/skia/zone.hxx b/vcl/inc/skia/zone.hxx
index 1f6bbb0dddca..6d503e7eb803 100644
--- a/vcl/inc/skia/zone.hxx
+++ b/vcl/inc/skia/zone.hxx
@@ -14,10 +14,13 @@
 
 #include <vcl/dllapi.h>
 
+#include <comphelper/solarmutex.hxx>
+
 // Used around calls to Skia code to detect crashes in drivers.
 class VCL_DLLPUBLIC SkiaZone : public CrashZone<SkiaZone>
 {
 public:
+    SkiaZone() { assert(comphelper::SolarMutex::get()->IsCurrentThread()); }
     static void hardDisable();
     static void relaxWatchdogTimings();
     static const CrashWatchdogTimingsValues& getCrashWatchdogTimingsValues();
diff --git a/vcl/skia/README b/vcl/skia/README
index f178ef8f3b76..c508beb33cea 100644
--- a/vcl/skia/README
+++ b/vcl/skia/README
@@ -59,6 +59,15 @@ You can also use 'visualbackendtest' to visually check some operations. Use some
 SAL_SKIA=raster SAL_ENABLESKIA=1 SAL_USE_VCLPLUGIN=gen [srcdir]/bin/run visualbackendtest
 
 
+Thread safety:
+==============
+
+SolarMutex must be held for most operations (asserted in SkiaSalGraphicsImpl::preDraw() and
+in SkiaZone constructor). The reason for this is that this restriction does not appear to be
+a problem, so there's no need to verify thread safety of the code (including the Skia library).
+There's probably no fundamental reason why the code couldn't be made thread-safe.
+
+
 GrDirectContext sharing:
 ========================
 


More information about the Libreoffice-commits mailing list