diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-12-18 12:53:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-19 11:19:56 +0100 |
commit | 4547c4d208a8978684d602a582b933898385008e (patch) | |
tree | 9a699691bdca20d5bb4840f12b5601474ebda467 /stoc | |
parent | 2e1cf05f3b1a7d111c538a2588e891aad67792bb (diff) |
use more cppu::BaseMutex
Change-Id: I1374d615e8e72286a23407c50b5fe5f52017926a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127084
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/security/access_controller.cxx | 21 | ||||
-rw-r--r-- | stoc/source/security/file_policy.cxx | 15 |
2 files changed, 15 insertions, 21 deletions
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index aaefd5dc39c7..c96f1f61f945 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -30,6 +30,7 @@ #include <uno/current_context.h> #include <uno/lbnames.h> +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/supportsservice.hxx> @@ -270,16 +271,12 @@ public: { ::uno_setCurrentContext( m_cc, s_envType.pData, nullptr ); } }; -struct MutexHolder -{ - Mutex m_mutex; -}; typedef WeakComponentImplHelper< security::XAccessController, lang::XServiceInfo, lang::XInitialization > t_helper; class AccessController - : public MutexHolder + : public cppu::BaseMutex , public t_helper { Reference< XComponentContext > m_xComponentContext; @@ -338,7 +335,7 @@ public: }; AccessController::AccessController( Reference< XComponentContext > const & xComponentContext ) - : t_helper( m_mutex ) + : t_helper( m_aMutex ) , m_xComponentContext( xComponentContext ) , m_mode( Mode::On ) // default , m_defaultPerm_init( false ) @@ -445,7 +442,7 @@ Reference< security::XPolicy > const & AccessController::getPolicy() "cannot get policy singleton!", static_cast<OWeakObject *>(this) ); } - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); if (! m_xPolicy.is()) { m_xPolicy = xPolicy; @@ -526,7 +523,7 @@ void AccessController::checkAndClearPostPoned() PermissionCollection const * pPermissions; // lookup policy for user { - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); pPermissions = m_user2permissions.lookup( p.first ); } OSL_ASSERT( pPermissions ); @@ -583,7 +580,7 @@ PermissionCollection AccessController::getEffectivePermissions( } // lookup policy for user - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); PermissionCollection const * pPermissions = m_user2permissions.lookup( userId ); if (pPermissions) return *pPermissions; @@ -623,7 +620,7 @@ PermissionCollection AccessController::getEffectivePermissions( PermissionCollection defaultPermissions( getPolicy()->getDefaultPermissions() ); // assign - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); if (! m_defaultPerm_init) { m_defaultPermissions = defaultPermissions; @@ -645,7 +642,7 @@ PermissionCollection AccessController::getEffectivePermissions( getPolicy()->getPermissions( userId ), m_defaultPermissions ); { // assign - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); if (m_singleUser_init) { ret = m_singleUserPermissions; @@ -672,7 +669,7 @@ PermissionCollection AccessController::getEffectivePermissions( getPolicy()->getPermissions( userId ), m_defaultPermissions ); { // cache - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); m_user2permissions.set( userId, ret ); } #ifdef __DIAGNOSE diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 293e2c44c4c9..91f75092bc22 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -24,6 +24,7 @@ #include <rtl/ustrbuf.hxx> #include <cppuhelper/access_control.hxx> +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/supportsservice.hxx> @@ -47,15 +48,11 @@ using namespace css::uno; namespace { -struct MutexHolder -{ - Mutex m_mutex; -}; typedef WeakComponentImplHelper< security::XPolicy, lang::XServiceInfo > t_helper; class FilePolicy - : public MutexHolder + : public cppu::BaseMutex , public t_helper { Reference< XComponentContext > m_xComponentContext; @@ -85,7 +82,7 @@ public: }; FilePolicy::FilePolicy( Reference< XComponentContext > const & xComponentContext ) - : t_helper( m_mutex ) + : t_helper( m_aMutex ) , m_xComponentContext( xComponentContext ) , m_ac( xComponentContext ) , m_init( false ) @@ -108,7 +105,7 @@ Sequence< Any > FilePolicy::getPermissions( m_init = true; } - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); t_permissions::iterator iFind( m_userPermissions.find( userId ) ); if (m_userPermissions.end() == iFind) { @@ -128,7 +125,7 @@ Sequence< Any > FilePolicy::getDefaultPermissions() m_init = true; } - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); return m_defaultPermissions; } @@ -462,7 +459,7 @@ void FilePolicy::refresh() } // assign new ones - MutexGuard guard( m_mutex ); + MutexGuard guard( m_aMutex ); m_defaultPermissions = defaultPermissions; m_userPermissions = userPermissions; } |