From e36e5dcc908bd996fba7012fa793ff094b1fb0c4 Mon Sep 17 00:00:00 2001 From: Arnaud Versini Date: Sun, 2 Jul 2017 10:57:42 +0200 Subject: comphelper : Simplify guards in OAccessibleContextHelper. Change-Id: Iabc7293370c7a8b3fdccb00d6e1cdbfac4c46992 Reviewed-on: https://gerrit.libreoffice.org/39445 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/comphelper/accessiblecontexthelper.hxx | 35 +++----------------------- 1 file changed, 4 insertions(+), 31 deletions(-) (limited to 'include/comphelper') diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx index 1cc27da80b3e..c29f61ff3bb0 100644 --- a/include/comphelper/accessiblecontexthelper.hxx +++ b/include/comphelper/accessiblecontexthelper.hxx @@ -48,6 +48,7 @@ namespace comphelper :public ::cppu::BaseMutex ,public OAccessibleContextHelper_Base { + friend class OContextEntryGuard; private: std::unique_ptr m_pImpl; @@ -103,21 +104,6 @@ namespace comphelper */ virtual css::lang::Locale SAL_CALL getLocale( ) override; - public: - // helper struct for granting selective access rights - struct OAccessControl - { - friend class OContextEntryGuard; - friend class OContextHelper_Impl; - friend class OExternalLockGuard; - private: - OAccessControl() { } - }; - - // ensures that the object is alive - inline void ensureAlive( const OAccessControl& ) const; - inline ::osl::Mutex& GetMutex( const OAccessControl& ); - protected: // OComponentHelper virtual void SAL_CALL disposing() override; @@ -162,21 +148,8 @@ namespace comphelper }; - inline void OAccessibleContextHelper::ensureAlive( const OAccessControl& ) const - { - ensureAlive(); - } - - - inline ::osl::Mutex& OAccessibleContextHelper::GetMutex( const OAccessControl& ) - { - return GetMutex(); - } - - //= OContextEntryGuard - typedef ::osl::ClearableMutexGuard OContextEntryGuard_Base; /** helper class for guarding the entry into OAccessibleContextHelper methods.

The class has two responsibilities: @@ -189,7 +162,7 @@ namespace comphelper you derived class.

*/ - class OContextEntryGuard : public OContextEntryGuard_Base + class OContextEntryGuard : public ::osl::ClearableMutexGuard { public: /** constructs the guard @@ -206,9 +179,9 @@ namespace comphelper inline OContextEntryGuard::OContextEntryGuard( OAccessibleContextHelper* _pContext ) - :OContextEntryGuard_Base( _pContext->GetMutex( OAccessibleContextHelper::OAccessControl() ) ) + : ::osl::ClearableMutexGuard( _pContext->GetMutex() ) { - _pContext->ensureAlive( OAccessibleContextHelper::OAccessControl() ); + _pContext->ensureAlive(); } -- cgit