[Libreoffice-commits] core.git: vcl/headless
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 28 15:37:15 UTC 2021
vcl/headless/svpinst.cxx | 51 ++++++++++++++++++++---------------------------
1 file changed, 22 insertions(+), 29 deletions(-)
New commits:
commit 64e8c2adbbe13cf082819229b8014ffb28911b76
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sun Jun 27 22:12:14 2021 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Mon Jun 28 17:36:42 2021 +0200
Test SvpSalYieldMutex like DBG_TESTSOLARMUTEX
Introduce and use DBG_TESTSVPYIELDMUTEX.
Change-Id: I002fa8faf744d69ab00ceeddda4f56b46aec0b34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118015
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 638052611360..b488d54d7527 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -62,6 +62,23 @@
SvpSalInstance* SvpSalInstance::s_pDefaultInstance = nullptr;
+#ifndef NDEBUG
+static bool g_CheckedMutex = false;
+
+#define DBG_TESTSVPYIELDMUTEX() \
+do { \
+ if (!g_CheckedMutex) \
+ { \
+ assert(dynamic_cast<SvpSalYieldMutex*>(GetYieldMutex()) != nullptr \
+ && "This SvpSalInstance function requires use of SvpSalYieldMutex"); \
+ g_CheckedMutex = true; \
+ } \
+} while(false)
+
+#else // NDEBUG
+#define DBG_TESTSVPYIELDMUTEX() ((void)0)
+#endif
+
#if !defined(ANDROID) && !defined(IOS)
static void atfork_child()
@@ -158,23 +175,11 @@ void SvpSalInstance::TriggerUserEventProcessing()
Wakeup();
}
-#ifndef NDEBUG
-static bool g_CheckedMutex = false;
-#endif
-
void SvpSalInstance::Wakeup(SvpRequest const request)
{
-#ifndef NDEBUG
- if (!g_CheckedMutex)
- {
- assert(dynamic_cast<SvpSalYieldMutex*>(GetYieldMutex()) != nullptr
- && "This SvpSalInstance function requires use of SvpSalYieldMutex");
- g_CheckedMutex = true;
- }
-#endif
+ DBG_TESTSVPYIELDMUTEX();
ImplSVData* pSVData = ImplGetSVData();
-
if (pSVData->mpWakeCallback && pSVData->mpPollClosure)
pSVData->mpWakeCallback(pSVData->mpPollClosure);
@@ -309,6 +314,8 @@ std::shared_ptr<SalBitmap> SvpSalInstance::CreateSalBitmap()
void SvpSalInstance::ProcessEvent( SalUserEvent aEvent )
{
+ DBG_TESTSVPYIELDMUTEX();
+
aEvent.m_pFrame->CallCallback( aEvent.m_nEvent, aEvent.m_pData );
if( aEvent.m_nEvent == SalEvent::Resize )
{
@@ -316,14 +323,7 @@ void SvpSalInstance::ProcessEvent( SalUserEvent aEvent )
const SvpSalFrame* pSvpFrame = static_cast<const SvpSalFrame*>( aEvent.m_pFrame);
pSvpFrame->PostPaint();
}
-#ifndef NDEBUG
- if (!g_CheckedMutex)
- {
- assert(dynamic_cast<SvpSalYieldMutex*>(GetYieldMutex()) != nullptr
- && "This SvpSalInstance function requires use of SvpSalYieldMutex");
- g_CheckedMutex = true;
- }
-#endif
+
SvpSalYieldMutex *const pMutex(static_cast<SvpSalYieldMutex*>(GetYieldMutex()));
pMutex->m_NonMainWaitingYieldCond.set();
}
@@ -448,14 +448,7 @@ void SvpSalInstance::updateMainThread()
bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
{
-#ifndef NDEBUG
- if (!g_CheckedMutex)
- {
- assert(dynamic_cast<SvpSalYieldMutex*>(GetYieldMutex()) != nullptr
- && "This SvpSalInstance function requires use of SvpSalYieldMutex");
- g_CheckedMutex = true;
- }
-#endif
+ DBG_TESTSVPYIELDMUTEX();
// first, process current user events
bool bEvent = DispatchUserEvents(bHandleAllCurrentEvents);
More information about the Libreoffice-commits
mailing list