summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-12-18 09:20:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-18 19:08:05 +0100
commit6b16793cd13e540c1dfc1686df948c0dbcbe8068 (patch)
tree2faa8db40660195054459b338a5b72c5bc790c0b /stoc
parenta22772c4393f4b0a3d1a838f074c4d51be762388 (diff)
use more cppu::BaseMutex
Change-Id: I1ee9aff2774a673666c332c116aa5b0ba0d8b585 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127077 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx63
1 files changed, 30 insertions, 33 deletions
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 5fb5b3962495..ddaee87576d8 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -25,6 +25,7 @@
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
+#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/implbase.hxx>
@@ -300,10 +301,6 @@ void OServiceManager_Listener::disposing(const EventObject & rEvt )
/*****************************************************************************
class OServiceManager
*****************************************************************************/
-struct OServiceManagerMutex
-{
- Mutex m_mutex;
-};
typedef WeakComponentImplHelper<
lang::XMultiServiceFactory, lang::XMultiComponentFactory, lang::XServiceInfo,
@@ -312,7 +309,7 @@ typedef WeakComponentImplHelper<
beans::XPropertySet > t_OServiceManager_impl;
class OServiceManager
- : public OServiceManagerMutex
+ : public cppu::BaseMutex
, public t_OServiceManager_impl
{
public:
@@ -426,7 +423,7 @@ typedef WeakComponentImplHelper<
container::XSet, container::XContentEnumerationAccess,
beans::XPropertySet > t_OServiceManagerWrapper_impl;
-class OServiceManagerWrapper : public OServiceManagerMutex, public t_OServiceManagerWrapper_impl
+class OServiceManagerWrapper : public cppu::BaseMutex, public t_OServiceManagerWrapper_impl
{
Reference< XComponentContext > m_xContext;
Reference< XMultiComponentFactory > m_root;
@@ -528,7 +525,7 @@ void SAL_CALL OServiceManagerWrapper::setPropertyValue(
static_cast<OWeakObject *>(this), 1 );
}
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
m_xContext = xContext;
}
@@ -543,7 +540,7 @@ Any SAL_CALL OServiceManagerWrapper::getPropertyValue(
{
if ( PropertyName == "DefaultContext" )
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
if( m_xContext.is() )
return makeAny( m_xContext );
else
@@ -565,7 +562,7 @@ void OServiceManagerWrapper::disposing()
OServiceManagerWrapper::OServiceManagerWrapper(
Reference< XComponentContext > const & xContext )
- : t_OServiceManagerWrapper_impl( m_mutex )
+ : t_OServiceManagerWrapper_impl( m_aMutex )
, m_xContext( xContext )
, m_root( xContext->getServiceManager() )
{
@@ -581,7 +578,7 @@ OServiceManagerWrapper::OServiceManagerWrapper(
* Create a ServiceManager
*/
OServiceManager::OServiceManager( Reference< XComponentContext > const & xContext )
- : t_OServiceManager_impl( m_mutex )
+ : t_OServiceManager_impl( m_aMutex )
, m_xContext( xContext )
, m_bInDisposing( false )
{}
@@ -599,7 +596,7 @@ void OServiceManager::disposing()
// dispose all factories
HashSet_Ref aImpls;
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
m_bInDisposing = true;
aImpls = m_ImplementationMap;
}
@@ -620,7 +617,7 @@ void OServiceManager::disposing()
// dispose
HashSet_Ref aImplMap;
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
// erase all members
m_ServiceMap = HashMultimap_OWString_Interface();
aImplMap = m_ImplementationMap;
@@ -645,7 +642,7 @@ Reference<XPropertySetInfo > OServiceManager::getPropertySetInfo()
"DefaultContext", -1, cppu::UnoType<decltype(m_xContext)>::get(), 0 ) };
Reference< beans::XPropertySetInfo > xInfo( new PropertySetInfo_Impl( seq ) );
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
if (! m_xPropertyInfo.is())
{
m_xPropertyInfo = xInfo;
@@ -673,7 +670,7 @@ void OServiceManager::setPropertyValue(
static_cast<OWeakObject *>(this), 1 );
}
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
m_xContext = xContext;
}
@@ -682,7 +679,7 @@ Any OServiceManager::getPropertyValue(const OUString& PropertyName)
check_undisposed();
if ( PropertyName == "DefaultContext" )
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
if( m_xContext.is() )
return makeAny( m_xContext );
else
@@ -728,7 +725,7 @@ void OServiceManager::removeVetoableChangeListener(
Reference<XEventListener > OServiceManager::getFactoryListener()
{
check_undisposed();
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
if( !xFactoryListener.is() )
xFactoryListener = new OServiceManager_Listener( this );
return xFactoryListener;
@@ -739,7 +736,7 @@ Sequence< OUString > OServiceManager::getUniqueAvailableServiceNames(
HashSet_OWString & aNameSet )
{
check_undisposed();
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
for( const auto& rEntry : m_ServiceMap )
aNameSet.insert( rEntry.first );
@@ -914,7 +911,7 @@ Sequence< Reference< XInterface > > OServiceManager::queryServiceFactories(
{
Sequence< Reference< XInterface > > ret;
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
::std::pair<
HashMultimap_OWString_Interface::iterator,
HashMultimap_OWString_Interface::iterator> p(
@@ -963,7 +960,7 @@ Reference<XEnumeration > OServiceManager::createContentEnumeration(
Reference<XEnumeration > OServiceManager::createEnumeration()
{
check_undisposed();
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
return new ImplementationEnumeration_Impl( m_ImplementationMap );
}
@@ -978,7 +975,7 @@ Type OServiceManager::getElementType()
sal_Bool OServiceManager::hasElements()
{
check_undisposed();
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
return !m_ImplementationMap.empty();
}
@@ -989,13 +986,13 @@ sal_Bool OServiceManager::has( const Any & Element )
if( Element.getValueTypeClass() == TypeClass_INTERFACE )
{
Reference<XInterface > xEle( Element, UNO_QUERY_THROW );
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
return m_ImplementationMap.find( xEle ) !=
m_ImplementationMap.end();
}
else if (auto implName = o3tl::tryAccess<OUString>(Element))
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
return m_ImplementationNameMap.find( *implName ) !=
m_ImplementationNameMap.end();
}
@@ -1015,7 +1012,7 @@ void OServiceManager::insert( const Any & Element )
Reference<XInterface > xEle( Element, UNO_QUERY_THROW );
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
HashSet_Ref::iterator aIt = m_ImplementationMap.find( xEle );
if( aIt != m_ImplementationMap.end() )
{
@@ -1067,7 +1064,7 @@ void OServiceManager::remove( const Any & Element )
}
else if (auto implName = o3tl::tryAccess<OUString>(Element))
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
HashMap_OWString_Interface::const_iterator const iFind(
m_ImplementationNameMap.find( *implName ) );
if (iFind == m_ImplementationNameMap.end())
@@ -1090,7 +1087,7 @@ void OServiceManager::remove( const Any & Element )
if( xComp.is() )
xComp->removeEventListener( getFactoryListener() );
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
HashSet_Ref::iterator aIt = m_ImplementationMap.find( xEle );
if( aIt == m_ImplementationMap.end() )
{
@@ -1208,7 +1205,7 @@ void ORegistryServiceManager::dispose()
return;
OServiceManager::dispose();
// dispose
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
// erase all members
m_xRegistry.clear();
m_xRootKey.clear();
@@ -1224,7 +1221,7 @@ Reference<XRegistryKey > ORegistryServiceManager::getRootKey()
{
if( !m_xRootKey.is() )
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
// DefaultRegistry suchen !!!!
if( !m_xRegistry.is() && !m_searchedRegistry )
{
@@ -1341,7 +1338,7 @@ void ORegistryServiceManager::fillAllNamesFromRegistry( HashSet_OWString & rSet
void ORegistryServiceManager::initialize(const Sequence< Any >& Arguments)
{
check_undisposed();
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
if (Arguments.hasElements())
{
m_xRootKey.clear();
@@ -1358,7 +1355,7 @@ void ORegistryServiceManager::initialize(const Sequence< Any >& Arguments)
Sequence< OUString > ORegistryServiceManager::getAvailableServiceNames()
{
check_undisposed();
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
// all names
HashSet_OWString aNameSet;
@@ -1387,7 +1384,7 @@ Sequence< Reference< XInterface > > ORegistryServiceManager::queryServiceFactori
}
else
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
Reference< XInterface > x( loadWithServiceName( aServiceName, xContext ) );
if (! x.is())
x = loadWithImplementationName( aServiceName, xContext );
@@ -1400,7 +1397,7 @@ Reference<XEnumeration > ORegistryServiceManager::createContentEnumeration(
const OUString& aServiceName )
{
check_undisposed();
- MutexGuard aGuard(m_mutex);
+ MutexGuard aGuard(m_aMutex);
// get all implementation names registered under this service name from the registry
const Sequence<OUString> aImpls = getFromServiceName( aServiceName );
// load and insert all factories specified by the registry
@@ -1428,7 +1425,7 @@ Reference<XPropertySetInfo > ORegistryServiceManager::getPropertySetInfo()
};
Reference< beans::XPropertySetInfo > xInfo( new PropertySetInfo_Impl( seq ) );
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
if (! m_xPropertyInfo.is())
{
m_xPropertyInfo = xInfo;
@@ -1442,7 +1439,7 @@ Any ORegistryServiceManager::getPropertyValue(const OUString& PropertyName)
check_undisposed();
if ( PropertyName == "Registry" )
{
- MutexGuard aGuard( m_mutex );
+ MutexGuard aGuard( m_aMutex );
if( m_xRegistry.is() )
return makeAny( m_xRegistry );
else