From b33fbd55d63042725ff9a014642f7c6bb02231f7 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 14 Jun 2021 15:43:27 +0200 Subject: Elide trivial TypeDescriptor_Init_Impl::getMutex ...after 859978445daeb848d033f64736709503ec44a7bb "flatten TypeDescriptor_Init_Impl data-structure" Change-Id: I6a7484dbbb93e7097edfb01db4f41d37fc4dc4b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- cppu/source/typelib/typelib.cxx | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'cppu') diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index a64ff8065553..7c392e147c89 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -178,8 +178,6 @@ struct TypeDescriptor_Init_Impl // The mutex to guard all type library accesses Mutex maMutex; - inline Mutex & getMutex(); - inline void callChain( typelib_TypeDescription ** ppRet, rtl_uString * pName ); #if OSL_DEBUG_LEVEL > 0 @@ -201,11 +199,6 @@ struct TypeDescriptor_Init_Impl } -inline Mutex & TypeDescriptor_Init_Impl::getMutex() -{ - return maMutex; -} - inline void TypeDescriptor_Init_Impl::callChain( typelib_TypeDescription ** ppRet, rtl_uString * pName ) { @@ -334,7 +327,7 @@ static void typelib_typedescription_initTables( } } - MutexGuard aGuard( Init::get().getMutex() ); + MutexGuard aGuard( Init::get().maMutex ); if( pTD->bComplete ) return; @@ -448,7 +441,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool initTables) { OSL_ASSERT( pTD == *ppTypeDescr ); // has to merge into existing one // insert into the cache - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); if( static_cast(rInit.maCache.size()) >= nCacheSize ) { typelib_typedescription_release( rInit.maCache.front() ); @@ -1345,7 +1338,7 @@ extern "C" void SAL_CALL typelib_typedescription_release( if( pTD->pWeakRef ) { { - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); // remove this description from the weak reference pTD->pWeakRef->pType = nullptr; } @@ -1355,7 +1348,7 @@ extern "C" void SAL_CALL typelib_typedescription_release( else { // this description is a reference too, so remove it from the hash table - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); WeakMap_Impl::iterator aIt = rInit.maWeakMap.find( pTD->pTypeName->buffer ); if( aIt != rInit.maWeakMap.end() && static_cast((*aIt).second) == static_cast(pTD) ) { @@ -1404,7 +1397,7 @@ extern "C" void SAL_CALL typelib_typedescription_register( { // connect the description with the weak reference TypeDescriptor_Init_Impl &rInit = Init::get(); - ClearableMutexGuard aGuard( rInit.getMutex() ); + ClearableMutexGuard aGuard( rInit.maMutex ); typelib_TypeDescriptionReference * pTDR = nullptr; typelib_typedescriptionreference_getByName( &pTDR, (*ppNewDescription)->pTypeName ); @@ -1886,7 +1879,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( if( !bInited ) { // guard against multi thread access - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); if( !bInited ) { // avoid recursion during the next ...new calls @@ -1933,7 +1926,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( { { // guard against multi thread access - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); // pTDR->pType->pWeakRef == 0 means that the description is empty if( pTDR->pType && pTDR->pType->pWeakRef ) { @@ -2030,7 +2023,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName( typelib_typedescription_register( ppRet ); // insert into the cache - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); if( static_cast(rInit.maCache.size()) >= nCacheSize ) { typelib_typedescription_release( rInit.maCache.front() ); @@ -2084,7 +2077,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new( typelib_typedescription_register( &pRet ); // insert into the cache - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); if( static_cast(rInit.maCache.size()) >= nCacheSize ) { typelib_typedescription_release( rInit.maCache.front() ); @@ -2108,7 +2101,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new( return; } - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); typelib_typedescriptionreference_getByName( ppTDR, pTypeName ); if( *ppTDR ) return; @@ -2161,7 +2154,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_release( if( ! osl_atomic_decrement( &pRef->nRefCount ) ) { TypeDescriptor_Init_Impl &rInit = Init::get(); - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); WeakMap_Impl::iterator aIt = rInit.maWeakMap.find( pRef->pTypeName->buffer ); if( aIt != rInit.maWeakMap.end() && (*aIt).second == pRef ) { @@ -2203,7 +2196,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_getDescription( } { - MutexGuard aGuard( Init::get().getMutex() ); + MutexGuard aGuard( Init::get().maMutex ); // pRef->pType->pWeakRef == 0 means that the description is empty if( pRef->pType && pRef->pType->pWeakRef ) { @@ -2241,7 +2234,7 @@ extern "C" void typelib_typedescriptionreference_getByName( } TypeDescriptor_Init_Impl &rInit = Init::get(); - MutexGuard aGuard( rInit.getMutex() ); + MutexGuard aGuard( rInit.maMutex ); WeakMap_Impl::const_iterator aIt = rInit.maWeakMap.find( pName->buffer ); if( aIt == rInit.maWeakMap.end() ) return; @@ -2296,7 +2289,6 @@ extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 nNewSize ) return; TypeDescriptor_Init_Impl &rInit = Init::get(); - MutexGuard aGuard( rInit.getMutex() ); if (nNewSize < nCacheSize) { while (static_cast(rInit.maCache.size()) != nNewSize) -- cgit