summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-11-21 18:39:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-11-22 09:52:18 +0100
commitef1e087dc94cf83b293e05e2cacbac69fa92bbdc (patch)
tree9cc5e66b5b3c5e57d4fb7345022d5ab49be9aa8f
parentosl::Mutex->std::mutex in OPropertyArrayUsageHelper (diff)
downloadcore-ef1e087dc94cf83b293e05e2cacbac69fa92bbdc.tar.gz
core-ef1e087dc94cf83b293e05e2cacbac69fa92bbdc.zip
osl::Mutex->std::mutex in MimeConfigurationHelper
Change-Id: Ib9a628d42448aea858271094ef5bdaac022b0f21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125633 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--comphelper/source/misc/mimeconfighelper.cxx20
-rw-r--r--include/comphelper/mimeconfighelper.hxx6
2 files changed, 17 insertions, 9 deletions
diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx
index 82867b7bae48..4bc4410c225c 100644
--- a/comphelper/source/misc/mimeconfighelper.cxx
+++ b/comphelper/source/misc/mimeconfighelper.cxx
@@ -116,8 +116,12 @@ uno::Sequence< sal_Int8 > MimeConfigurationHelper::GetSequenceClassIDRepresentat
uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetConfigurationByPath( const OUString& aPath )
{
- osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
+ return GetConfigurationByPathImpl(aPath);
+}
+uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetConfigurationByPathImpl( const OUString& aPath )
+{
uno::Reference< container::XNameAccess > xConfig;
try
@@ -143,10 +147,10 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetConfigurati
uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetObjConfiguration()
{
- osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if ( !m_xObjectConfig.is() )
- m_xObjectConfig = GetConfigurationByPath(
+ m_xObjectConfig = GetConfigurationByPathImpl(
"/org.openoffice.Office.Embedding/Objects" );
return m_xObjectConfig;
@@ -155,10 +159,10 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetObjConfigur
uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetVerbsConfiguration()
{
- osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if ( !m_xVerbsConfig.is() )
- m_xVerbsConfig = GetConfigurationByPath(
+ m_xVerbsConfig = GetConfigurationByPathImpl(
"/org.openoffice.Office.Embedding/Verbs");
return m_xVerbsConfig;
@@ -167,10 +171,10 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetVerbsConfig
uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetMediaTypeConfiguration()
{
- osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if ( !m_xMediaTypeConfig.is() )
- m_xMediaTypeConfig = GetConfigurationByPath(
+ m_xMediaTypeConfig = GetConfigurationByPathImpl(
"/org.openoffice.Office.Embedding/MimeTypeClassIDRelations");
return m_xMediaTypeConfig;
@@ -179,7 +183,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetMediaTypeCo
uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetFilterFactory()
{
- osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if ( !m_xFilterFactory.is() )
m_xFilterFactory.set(
diff --git a/include/comphelper/mimeconfighelper.hxx b/include/comphelper/mimeconfighelper.hxx
index 5a5585f00d55..4e674538e29c 100644
--- a/include/comphelper/mimeconfighelper.hxx
+++ b/include/comphelper/mimeconfighelper.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <comphelper/comphelperdllapi.h>
+#include <mutex>
namespace com::sun::star::beans { struct NamedValue; }
namespace com::sun::star::beans { struct PropertyValue; }
@@ -37,7 +38,7 @@ namespace comphelper {
class COMPHELPER_DLLPUBLIC MimeConfigurationHelper
{
- ::osl::Mutex m_aMutex;
+ std::mutex m_aMutex;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider;
@@ -133,6 +134,9 @@ public:
static css::uno::Sequence< sal_Int8 > GetSequenceClassID( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
+private:
+ css::uno::Reference< css::container::XNameAccess >
+ GetConfigurationByPathImpl( const OUString& aPath );
};
}