From 11fd73acce5d8bff7025bb6ddcbaf99d9d70b545 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 14 May 2013 13:15:38 +0200 Subject: SolarMutex does not belong into the URE interface ...so move it from osl/mutex.hxx to its own comphelper/solarmutex.hxx. It looks like a newbie mistake that 59e7685d8d812ee8773f57475cbe3aa2a0bdfc81 "Create an abstract interface to be used to implement a SolarMutex" put it here in the first place. I do not consider this an incompatible change really, as no external URE client code should have used SolarMutex anyway. (Also included some clean up, like removing unused {Clearable,Resettable}SolarGuard, and spelling out SolarGuard in the few places it is used.) Change-Id: I121ffb5b7cefbc19e88b5405e5a85ffc895be852 --- comphelper/Library_comphelper.mk | 1 + comphelper/source/misc/solarmutex.cxx | 28 +++++++++++++++ .../source/property/ChainablePropertySet.cxx | 20 +++++------ comphelper/source/property/MasterPropertySet.cxx | 42 +++++++++++----------- 4 files changed, 60 insertions(+), 31 deletions(-) create mode 100644 comphelper/source/misc/solarmutex.cxx (limited to 'comphelper') diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk index 0746889742b2..09a68895f81f 100644 --- a/comphelper/Library_comphelper.mk +++ b/comphelper/Library_comphelper.mk @@ -106,6 +106,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\ comphelper/source/misc/servicedecl \ comphelper/source/misc/serviceinfohelper \ comphelper/source/misc/sharedmutex \ + comphelper/source/misc/solarmutex \ comphelper/source/misc/stillreadwriteinteraction \ comphelper/source/misc/anycompare \ comphelper/source/misc/storagehelper \ diff --git a/comphelper/source/misc/solarmutex.cxx b/comphelper/source/misc/solarmutex.cxx new file mode 100644 index 000000000000..af17a9a39347 --- /dev/null +++ b/comphelper/source/misc/solarmutex.cxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "sal/config.h" + +#include "comphelper/solarmutex.hxx" + +comphelper::SolarMutex::SolarMutex() {} + +comphelper::SolarMutex::~SolarMutex() {} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/ChainablePropertySet.cxx b/comphelper/source/property/ChainablePropertySet.cxx index cd078a9f59e9..c4cc545d63a6 100644 --- a/comphelper/source/property/ChainablePropertySet.cxx +++ b/comphelper/source/property/ChainablePropertySet.cxx @@ -19,7 +19,7 @@ #include #include -#include +#include #include @@ -31,7 +31,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; -ChainablePropertySet::ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, osl::SolarMutex* pMutex ) +ChainablePropertySet::ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, comphelper::SolarMutex* pMutex ) throw() : mpInfo ( pInfo ) , mpMutex ( pMutex ) @@ -55,9 +55,9 @@ void SAL_CALL ChainablePropertySet::setPropertyValue( const OUString& rPropertyN throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -73,9 +73,9 @@ Any SAL_CALL ChainablePropertySet::getPropertyValue( const OUString& rPropertyNa throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -119,9 +119,9 @@ void SAL_CALL ChainablePropertySet::setPropertyValues( const Sequence< OUString throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -153,9 +153,9 @@ Sequence< Any > SAL_CALL ChainablePropertySet::getPropertyValues( const Sequence throw(RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index f996e8b1fc7d..6477e11ee329 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include @@ -30,16 +30,16 @@ class AutoOGuardArray { - boost::scoped_ptr< osl::SolarGuard > * mpGuardArray; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > * mpGuardArray; public: AutoOGuardArray( sal_Int32 nNumElements ); ~AutoOGuardArray(); - boost::scoped_ptr< osl::SolarGuard > & operator[] ( sal_Int32 i ) { return mpGuardArray[i]; } + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > & operator[] ( sal_Int32 i ) { return mpGuardArray[i]; } }; -AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements ) : mpGuardArray(new boost::scoped_ptr< osl::SolarGuard >[nNumElements]) +AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements ) : mpGuardArray(new boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > >[nNumElements]) { } @@ -67,7 +67,7 @@ SlaveData::SlaveData ( ChainablePropertySet *pSlave) { } -MasterPropertySet::MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, osl::SolarMutex* pMutex ) +MasterPropertySet::MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, comphelper::SolarMutex* pMutex ) throw() : mpInfo ( pInfo ) , mpMutex ( pMutex ) @@ -105,9 +105,9 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const OUString& rPropertyName throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -125,9 +125,9 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const OUString& rPropertyName ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave; // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard2; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard2; if (pSlave->mpMutex) - pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) ); + pMutexGuard2.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) ); pSlave->_preSetValues(); pSlave->_setSingleValue( *((*aIter).second->mpInfo), rValue ); @@ -139,9 +139,9 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const OUString& rPropertyName throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -160,9 +160,9 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const OUString& rPropertyName ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave; // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard2; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard2; if (pSlave->mpMutex) - pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) ); + pMutexGuard2.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) ); pSlave->_preGetValues(); pSlave->_getSingleValue( *((*aIter).second->mpInfo), aAny ); @@ -200,9 +200,9 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >& throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -239,7 +239,7 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >& { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). if (pSlave->mpSlave->mpMutex) - aOGuardArray[i].reset( new osl::SolarGuard(pSlave->mpSlave->mpMutex) ); + aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpSlave->mpMutex) ); pSlave->mpSlave->_preSetValues(); pSlave->SetInit ( sal_True ); @@ -266,9 +266,9 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< O throw(RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -304,7 +304,7 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< O { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). if (pSlave->mpSlave->mpMutex) - aOGuardArray[i].reset( new osl::SolarGuard(pSlave->mpSlave->mpMutex) ); + aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpSlave->mpMutex) ); pSlave->mpSlave->_preGetValues(); pSlave->SetInit ( sal_True ); @@ -367,9 +367,9 @@ PropertyState SAL_CALL MasterPropertySet::getPropertyState( const OUString& Prop ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave; // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (pSlave->mpMutex) - pMutexGuard.reset( new osl::SolarGuard(pSlave->mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) ); pSlave->_preGetPropertyState(); pSlave->_getPropertyState( *((*aIter).second->mpInfo), aState ); -- cgit