diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-12-18 13:02:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-19 17:46:47 +0100 |
commit | 64589ddc911ed7bcc334adecd46b472adfec15f2 (patch) | |
tree | 0d43198cc540c5f5f99e7eab8fc1d7ff73e9316f /cppuhelper | |
parent | 3fd6e05a77e0e9ca1db6c7f9e5a1b17d32250b36 (diff) |
use more cppu::BaseMutex
Change-Id: I7ac096acfde05aa58a48fb76e895e880e27225d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127085
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/component_context.cxx | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index 1aa3d33e5c35..440fe18cfa4d 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -27,6 +27,7 @@ #include <uno/lbnames.h> #include <uno/mapping.hxx> +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/component_context.hxx> #include <cppuhelper/implbase.hxx> @@ -113,15 +114,8 @@ void DisposingForwarder::disposing( lang::EventObject const & ) namespace { -struct MutexHolder -{ -protected: - Mutex m_mutex; -}; - - class ComponentContext - : private MutexHolder + : private cppu::BaseMutex , public WeakComponentImplHelper< XComponentContext, container::XNameContainer > { @@ -184,7 +178,7 @@ void ComponentContext::insertByName( /* lateInit_: */ name.startsWith( "/singletons/" ) && !element.hasValue() ); - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); std::pair<t_map::iterator, bool> insertion( m_map.emplace( name, entry ) ); if (! insertion.second) @@ -196,7 +190,7 @@ void ComponentContext::insertByName( void ComponentContext::removeByName( OUString const & name ) { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); t_map::iterator iFind( m_map.find( name ) ); if (iFind == m_map.end()) throw container::NoSuchElementException( @@ -211,7 +205,7 @@ void ComponentContext::removeByName( OUString const & name ) void ComponentContext::replaceByName( OUString const & name, Any const & element ) { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); t_map::iterator iFind( m_map.find( name ) ); if (iFind == m_map.end()) throw container::NoSuchElementException( @@ -240,14 +234,14 @@ Any ComponentContext::getByName( OUString const & name ) Sequence<OUString> ComponentContext::getElementNames() { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); return comphelper::mapKeysToSequence(m_map); } sal_Bool ComponentContext::hasByName( OUString const & name ) { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); return m_map.find( name ) != m_map.end(); } @@ -261,14 +255,14 @@ Type ComponentContext::getElementType() sal_Bool ComponentContext::hasElements() { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); return ! m_map.empty(); } Any ComponentContext::lookupMap( OUString const & rName ) { - ResettableMutexGuard guard( m_mutex ); + ResettableMutexGuard guard( m_aMutex ); t_map::iterator iFind( m_map.find( rName ) ); if (iFind == m_map.end()) return Any(); @@ -403,7 +397,7 @@ void ComponentContext::disposing() if (rEntry.lateInit) { // late init - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); if (rEntry.lateInit) { rEntry.value.clear(); // release factory @@ -464,7 +458,7 @@ void ComponentContext::disposing() ComponentContext::ComponentContext( ContextEntry_Init const * pEntries, sal_Int32 nEntries, Reference< XComponentContext > const & xDelegate ) - : WeakComponentImplHelper( m_mutex ), + : WeakComponentImplHelper( m_aMutex ), m_xDelegate( xDelegate ) { for ( sal_Int32 nPos = 0; nPos < nEntries; ++nPos ) |