diff options
-rw-r--r-- | vcl/Module_vcl.mk | 2 | ||||
-rw-r--r-- | vcl/headless/svpinst.cxx | 93 | ||||
-rw-r--r-- | vcl/inc/headless/svpinst.hxx | 30 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 7 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkinst.cxx | 52 |
5 files changed, 6 insertions, 178 deletions
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 998598791385..0a91f8795cc8 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -31,7 +31,6 @@ $(eval $(call gb_Module_Module,vcl)) $(eval $(call gb_Module_add_targets,vcl,\ Library_vcl \ - Library_vclplug_svp \ StaticLibrary_vclmain \ Package_inc \ Package_afmhash \ @@ -40,6 +39,7 @@ $(eval $(call gb_Module_add_targets,vcl,\ ifeq ($(GUIBASE),unx) $(eval $(call gb_Module_add_targets,vcl,\ + Library_vclplug_svp \ Library_vclplug_gen \ Library_desktop_detector \ )) diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 182cf867529e..b3e868316a58 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -53,7 +53,7 @@ extern "C" { SAL_DLLPUBLIC_EXPORT SalInstance* create_SalInstance() { - SvpSalInstance* pInstance = new SvpSalInstance(); + SvpSalInstance* pInstance = new SvpSalInstance( new SalYieldMutex() ); SalData* pSalData = new SalData(); pSalData->m_pInstance = pInstance; SetSalData( pSalData ); @@ -77,8 +77,8 @@ bool SvpSalInstance::isFrameAlive( const SalFrame* pFrame ) const SvpSalInstance* SvpSalInstance::s_pDefaultInstance = NULL; -SvpSalInstance::SvpSalInstance() : - SalGenericInstance( new SalYieldMutex() ) +SvpSalInstance::SvpSalInstance( SalYieldMutex *pMutex ) : + SalGenericInstance( pMutex ) { m_aTimeout.tv_sec = 0; m_aTimeout.tv_usec = 0; @@ -304,51 +304,6 @@ SalBitmap* SvpSalInstance::CreateSalBitmap() return new SvpSalBitmap(); } -osl::SolarMutex* SvpSalInstance::GetYieldMutex() -{ - return &m_aYieldMutex; -} - -sal_uLong SvpSalInstance::ReleaseYieldMutex() -{ - if ( m_aYieldMutex.GetThreadId() == - osl::Thread::getCurrentIdentifier() ) - { - sal_uLong nCount = m_aYieldMutex.GetAcquireCount(); - sal_uLong n = nCount; - while ( n ) - { - m_aYieldMutex.release(); - n--; - } - - return nCount; - } - else - return 0; -} - -void SvpSalInstance::AcquireYieldMutex( sal_uLong nCount ) -{ - while ( nCount ) - { - m_aYieldMutex.acquire(); - nCount--; - } -} - -bool SvpSalInstance::CheckYieldMutex() -{ - bool bRet = true; - - if ( m_aYieldMutex.GetThreadId() != ::osl::Thread::getCurrentIdentifier() ) - { - bRet = false; - } - - return bRet; -} - void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { // first, check for already queued events. @@ -453,48 +408,6 @@ void* SvpSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturn return const_cast<char*>(""); } -// ------------------------------------------------------------------------- -// -// SalYieldMutex -// -// ------------------------------------------------------------------------- - -SvpSalYieldMutex::SvpSalYieldMutex() -{ - mnCount = 0; - mnThreadId = 0; -} - -void SvpSalYieldMutex::acquire() -{ - SolarMutexObject::acquire(); - mnThreadId = osl::Thread::getCurrentIdentifier(); - mnCount++; -} - -void SvpSalYieldMutex::release() -{ - if ( mnThreadId == osl::Thread::getCurrentIdentifier() ) - { - if ( mnCount == 1 ) - mnThreadId = 0; - mnCount--; - } - SolarMutexObject::release(); -} - -sal_Bool SvpSalYieldMutex::tryToAcquire() -{ - if ( SolarMutexObject::tryToAcquire() ) - { - mnThreadId = osl::Thread::getCurrentIdentifier(); - mnCount++; - return sal_True; - } - else - return sal_False; -} - // --------------- // - SalTimer - // --------------- diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx index 34a9c7f8ba2e..d3307abdb5ed 100644 --- a/vcl/inc/headless/svpinst.hxx +++ b/vcl/inc/headless/svpinst.hxx @@ -46,27 +46,6 @@ #define VIRTUAL_DESKTOP_HEIGHT 768 #define VIRTUAL_DESKTOP_DEPTH 24 -// ------------------------------------------------------------------------- -// SalYieldMutex -// ------------------------------------------------------------------------- - -class SvpSalYieldMutex : public ::vcl::SolarMutexObject -{ -protected: - sal_uLong mnCount; - oslThreadIdentifier mnThreadId; - -public: - SvpSalYieldMutex(); - - virtual void acquire(); - virtual void release(); - virtual sal_Bool tryToAcquire(); - - sal_uLong GetAcquireCount() const { return mnCount; } - oslThreadIdentifier GetThreadId() const { return mnThreadId; } -}; - // --------------- // - SalTimer - // --------------- @@ -92,7 +71,6 @@ class SvpSalInstance : public SalGenericInstance timeval m_aTimeout; sal_uLong m_nTimeoutMS; int m_pTimeoutFDS[2]; - SvpSalYieldMutex m_aYieldMutex; // internal event queue struct SalUserEvent @@ -118,7 +96,7 @@ class SvpSalInstance : public SalGenericInstance public: static SvpSalInstance* s_pDefaultInstance; - SvpSalInstance(); + SvpSalInstance( SalYieldMutex *pMutex ); virtual ~SvpSalInstance(); void PostEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent ); @@ -177,12 +155,6 @@ public: // SalBitmap virtual SalBitmap* CreateSalBitmap(); - // YieldMutex - virtual osl::SolarMutex* GetYieldMutex(); - virtual sal_uLong ReleaseYieldMutex(); - virtual void AcquireYieldMutex( sal_uLong nCount ); - virtual bool CheckYieldMutex(); - // wait next event and dispatch // must returned by UserEvent (SalFrame::PostEvent) // and timer diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index e6e0076e6d77..e27042aa9f6a 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -82,10 +82,9 @@ public: #if GTK_CHECK_VERSION(3,0,0) class GtkInstance : public SvpSalInstance { - SalYieldMutex *mpSalYieldMutex; public: GtkInstance( SalYieldMutex* pMutex ) - : SvpSalInstance(), mpSalYieldMutex( pMutex ) + : SvpSalInstance( pMutex ) #else class GtkInstance : public X11SalInstance { @@ -108,10 +107,6 @@ public: const SystemGraphicsData* ); virtual SalBitmap* CreateSalBitmap(); - virtual osl::SolarMutex* GetYieldMutex(); - virtual sal_uIntPtr ReleaseYieldMutex(); - virtual void AcquireYieldMutex( sal_uIntPtr nCount ); - virtual bool CheckYieldMutex(); virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( sal_uInt16 nType ); }; diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index 223dc424ce7c..301e6f029bea 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -443,59 +443,7 @@ SalBitmap* GtkInstance::CreateSalBitmap() SalTimer* GtkInstance::CreateSalTimer() { -#if GTK_CHECK_VERSION(3,0,0) return new GtkSalTimer(); -#else - return X11SalInstance::CreateSalTimer(); -#endif -} - -// FIXME: these should all be in a more generic, shared base of unix's salinst.cxx - -osl::SolarMutex* GtkInstance::GetYieldMutex() -{ - return mpSalYieldMutex; -} - -sal_uIntPtr GtkInstance::ReleaseYieldMutex() -{ - SalYieldMutex* pYieldMutex = mpSalYieldMutex; - if ( pYieldMutex->GetThreadId() == - osl::Thread::getCurrentIdentifier() ) - { - sal_uLong nCount = pYieldMutex->GetAcquireCount(); - sal_uLong n = nCount; - while ( n ) - { - pYieldMutex->release(); - n--; - } - - return nCount; - } - else - return 0; -} - -void GtkInstance::AcquireYieldMutex( sal_uIntPtr nCount ) -{ - SalYieldMutex* pYieldMutex = mpSalYieldMutex; - while ( nCount ) - { - pYieldMutex->acquire(); - nCount--; - } -} - -bool GtkInstance::CheckYieldMutex() -{ - bool bRet = true; - - SalYieldMutex* pYieldMutex = mpSalYieldMutex; - if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier() ) - bRet = false; - - return bRet; } void GtkInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) |