diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-09-13 13:12:00 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-09-18 11:41:52 +0200 |
commit | 0c27134fb993b30e1a0ce827364c35f8fbaac359 (patch) | |
tree | 24c7e472d5379c05e71f023278d50625d67823e9 /vcl/win | |
parent | fb1ef04ef8edac85f2d391c508e286621057fef6 (diff) |
Move yield mutex handling into SalInstance
After the refectoring in commit 4c93de2c921b ("merge
GenericSolarMutex and SolarMutex"), there is no more need to
prevent instantiation of comphelper::SolarMutex objects.
Since every VCL backend implements the yield mutex management in
the same way, we can move the general implementation into the
SalInstance.
While at it use std::unique_ptr for the yield mutex on Mac and
Windows platforms.
Change-Id: Ibe0610bd92b4623152ee14e7a35b52465d403720
Reviewed-on: https://gerrit.libreoffice.org/60570
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/app/salinst.cxx | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index 0f422f3cfc72..d7f8da7471f9 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -133,7 +133,7 @@ void SalYieldMutex::doAcquire( sal_uInt32 nLockCount ) if ( pInst->m_nNoYieldLock ) return; // tdf#96887 If this is the main thread, then we must wait for two things: - // - the mpSalYieldMutex being freed + // - the yield mutex being unlocked // - SendMessage() being triggered // This can nicely be done using MsgWaitForMultipleObjects. The 2nd one is // needed because if we don't reschedule, then we create deadlocks if a @@ -189,13 +189,13 @@ void ImplSalYieldMutexAcquireWithWait( sal_uInt32 nCount ) { WinSalInstance* pInst = GetSalData()->mpInstance; if ( pInst ) - pInst->mpSalYieldMutex->acquire( nCount ); + pInst->GetYieldMutex()->acquire( nCount ); } bool ImplSalYieldMutexTryToAcquire() { WinSalInstance* pInst = GetSalData()->mpInstance; - return pInst && pInst->mpSalYieldMutex->tryToAcquire(); + return pInst && pInst->GetYieldMutex()->tryToAcquire(); } void ImplSalYieldMutexRelease() @@ -204,7 +204,7 @@ void ImplSalYieldMutexRelease() if ( pInst ) { GdiFlush(); - pInst->mpSalYieldMutex->release(); + pInst->GetYieldMutex()->release(); } } @@ -422,35 +422,19 @@ void DestroySalInstance( SalInstance* pInst ) } WinSalInstance::WinSalInstance() - : mhComWnd( nullptr ) + : SalInstance(o3tl::make_unique<SalYieldMutex>()) + , mhComWnd( nullptr ) , m_nNoYieldLock( 0 ) { - mpSalYieldMutex = new SalYieldMutex(); - mpSalYieldMutex->acquire(); + GetYieldMutex()->acquire(); } WinSalInstance::~WinSalInstance() { - mpSalYieldMutex->release(); - delete mpSalYieldMutex; + GetYieldMutex()->release(); DestroyWindow( mhComWnd ); } -comphelper::SolarMutex* WinSalInstance::GetYieldMutex() -{ - return mpSalYieldMutex; -} - -sal_uInt32 WinSalInstance::ReleaseYieldMutexAll() -{ - return mpSalYieldMutex->release( true/*bUnlockAll*/ ); -} - -void WinSalInstance::AcquireYieldMutex( sal_uInt32 nCount ) -{ - mpSalYieldMutex->acquire( nCount ); -} - static LRESULT ImplSalDispatchMessage( const MSG* pMsg ) { SalData* pSalData = GetSalData(); |