summaryrefslogtreecommitdiff
path: root/vcl/osx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2018-09-13 13:12:00 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2018-09-18 11:41:52 +0200
commit0c27134fb993b30e1a0ce827364c35f8fbaac359 (patch)
tree24c7e472d5379c05e71f023278d50625d67823e9 /vcl/osx
parentfb1ef04ef8edac85f2d391c508e286621057fef6 (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/osx')
-rw-r--r--vcl/osx/salinst.cxx30
1 files changed, 7 insertions, 23 deletions
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 17f7d89adb07..0314b85ef1f8 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -114,7 +114,7 @@ public:
void AquaSalInstance::delayedSettingsChanged( bool bInvalidate )
{
- osl::Guard< comphelper::SolarMutex > aGuard( *mpSalYieldMutex );
+ osl::Guard< comphelper::SolarMutex > aGuard( *GetYieldMutex() );
AquaDelayedSettingsChanged* pIdle = new AquaDelayedSettingsChanged( bInvalidate );
pIdle->SetDebugName( "AquaSalInstance AquaDelayedSettingsChanged" );
pIdle->Start();
@@ -355,7 +355,7 @@ bool ImplSalYieldMutexTryToAcquire()
{
AquaSalInstance* pInst = GetSalData()->mpInstance;
if ( pInst )
- return pInst->mpSalYieldMutex->tryToAcquire();
+ return pInst->GetYieldMutex()->tryToAcquire();
else
return FALSE;
}
@@ -364,7 +364,7 @@ void ImplSalYieldMutexRelease()
{
AquaSalInstance* pInst = GetSalData()->mpInstance;
if ( pInst )
- pInst->mpSalYieldMutex->release();
+ pInst->GetYieldMutex()->release();
}
SalInstance* CreateSalInstance()
@@ -398,20 +398,19 @@ void DestroySalInstance( SalInstance* pInst )
}
AquaSalInstance::AquaSalInstance()
- : mnActivePrintJobs( 0 )
+ : SalInstance(o3tl::make_unique<SalYieldMutex>())
+ , mnActivePrintJobs( 0 )
, mbIsLiveResize( false )
, mbNoYieldLock( false )
, mbTimerProcessed( false )
{
- mpSalYieldMutex = new SalYieldMutex;
- mpSalYieldMutex->acquire();
+ GetYieldMutex()->acquire();
maMainThread = osl::Thread::getCurrentIdentifier();
}
AquaSalInstance::~AquaSalInstance()
{
- mpSalYieldMutex->release();
- delete mpSalYieldMutex;
+ GetYieldMutex()->release();
}
void AquaSalInstance::TriggerUserEventProcessing()
@@ -427,21 +426,6 @@ void AquaSalInstance::ProcessEvent( SalUserEvent aEvent )
maWaitingYieldCond.set();
}
-comphelper::SolarMutex* AquaSalInstance::GetYieldMutex()
-{
- return mpSalYieldMutex;
-}
-
-sal_uInt32 AquaSalInstance::ReleaseYieldMutexAll()
-{
- return mpSalYieldMutex->release( true/*bUnlockAll*/ );
-}
-
-void AquaSalInstance::AcquireYieldMutex( sal_uInt32 nCount )
-{
- mpSalYieldMutex->acquire( nCount );
-}
-
bool AquaSalInstance::IsMainThread() const
{
return osl::Thread::getCurrentIdentifier() == maMainThread;