diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-01-30 22:09:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-31 08:20:30 +0000 |
commit | 07699b6e7847c141c0bdec2e5345f2d00cb219dd (patch) | |
tree | 6f6e6eda2d76ded5f77fd1a6ae9aeab0c024e121 /animations | |
parent | 061d3bc359b6b94a874c10e96ad9cc8189494e21 (diff) |
osl::Mutex->std::mutex in AnimationNode
Change-Id: I9a07afcdf17ca464e6a1083fbd7ec1e1f7186a30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146369
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'animations')
-rw-r--r-- | animations/source/animcore/animcore.cxx | 365 |
1 files changed, 185 insertions, 180 deletions
diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index 16254209fcf3..0f6f03aadabd 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -48,17 +48,17 @@ #include <comphelper/servicehelper.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/queryinterface.hxx> -#include <comphelper/interfacecontainer3.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weakref.hxx> #include <cppuhelper/implbase.hxx> #include <o3tl/safeint.hxx> -#include <osl/mutex.hxx> #include <sal/log.hxx> #include <unotools/weakref.hxx> #include <array> +#include <mutex> #include <vector> #include <algorithm> #include <mutex> @@ -68,8 +68,8 @@ namespace com::sun::star::beans { struct NamedValue; } using ::osl::Mutex; using ::osl::Guard; -using ::comphelper::OInterfaceContainerHelper3; -using ::comphelper::OInterfaceIteratorHelper3; +using ::comphelper::OInterfaceContainerHelper4; +using ::comphelper::OInterfaceIteratorHelper4; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::XInterface; @@ -104,8 +104,7 @@ namespace animcore { namespace { -class AnimationNodeBase : public cppu::BaseMutex, - public XAnimateMotion, +class AnimationNodeBase : public XAnimateMotion, public XAnimatePhysics, public XAnimateColor, public XTransitionFilter, @@ -291,10 +290,11 @@ public: virtual void SAL_CALL addChangesListener( const Reference< XChangesListener >& aListener ) override; virtual void SAL_CALL removeChangesListener( const Reference< XChangesListener >& aListener ) override; - void fireChangeListener(); + void fireChangeListener(std::unique_lock<std::mutex>&); private: - OInterfaceContainerHelper3<XChangesListener> maChangeListener; + std::mutex m_aMutex; + OInterfaceContainerHelper4<XChangesListener> maChangeListener; static void initTypeProvider( sal_Int16 nNodeType ) noexcept; @@ -411,7 +411,6 @@ std::array<Sequence< Type >*, 13> AnimationNode::mpTypes = { nullptr, nullptr, n AnimationNode::AnimationNode( sal_Int16 nNodeType ) : AnimationNodeBase(), - maChangeListener(m_aMutex), mnNodeType( nNodeType ), mnFill( AnimationFill::DEFAULT ), mnFillDefault( AnimationFill::INHERIT ), @@ -444,7 +443,6 @@ AnimationNode::AnimationNode( sal_Int16 nNodeType ) AnimationNode::AnimationNode( const AnimationNode& rNode ) : AnimationNodeBase(), - maChangeListener(m_aMutex), mnNodeType( rNode.mnNodeType ), // attributes for the XAnimationNode interface implementation @@ -918,7 +916,7 @@ Sequence< OUString > AnimationNode::getSupportedServiceNames() // XAnimationNode sal_Int16 SAL_CALL AnimationNode::getType() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnNodeType; } @@ -926,7 +924,7 @@ sal_Int16 SAL_CALL AnimationNode::getType() // XAnimationNode Any SAL_CALL AnimationNode::getBegin() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maBegin; } @@ -934,11 +932,11 @@ Any SAL_CALL AnimationNode::getBegin() // XAnimationNode void SAL_CALL AnimationNode::setBegin( const Any& _begin ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if( _begin != maBegin ) { maBegin = _begin; - fireChangeListener(); + fireChangeListener(aGuard); } } @@ -946,7 +944,7 @@ void SAL_CALL AnimationNode::setBegin( const Any& _begin ) // XAnimationNode Any SAL_CALL AnimationNode::getDuration() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maDuration; } @@ -954,11 +952,11 @@ Any SAL_CALL AnimationNode::getDuration() // XAnimationNode void SAL_CALL AnimationNode::setDuration( const Any& _duration ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if( _duration != maDuration ) { maDuration = _duration; - fireChangeListener(); + fireChangeListener(aGuard); } } @@ -966,7 +964,7 @@ void SAL_CALL AnimationNode::setDuration( const Any& _duration ) // XAnimationNode Any SAL_CALL AnimationNode::getEnd() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maEnd; } @@ -974,11 +972,11 @@ Any SAL_CALL AnimationNode::getEnd() // XAnimationNode void SAL_CALL AnimationNode::setEnd( const Any& _end ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if( _end != maEnd ) { maEnd = _end; - fireChangeListener(); + fireChangeListener(aGuard); } } @@ -986,7 +984,7 @@ void SAL_CALL AnimationNode::setEnd( const Any& _end ) // XAnimationNode Any SAL_CALL AnimationNode::getEndSync() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maEndSync; } @@ -994,11 +992,11 @@ Any SAL_CALL AnimationNode::getEndSync() // XAnimationNode void SAL_CALL AnimationNode::setEndSync( const Any& _endsync ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _endsync != maEndSync ) { maEndSync = _endsync; - fireChangeListener(); + fireChangeListener(l); } } @@ -1006,7 +1004,7 @@ void SAL_CALL AnimationNode::setEndSync( const Any& _endsync ) // XAnimationNode Any SAL_CALL AnimationNode::getRepeatCount() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maRepeatCount; } @@ -1014,11 +1012,11 @@ Any SAL_CALL AnimationNode::getRepeatCount() // XAnimationNode void SAL_CALL AnimationNode::setRepeatCount( const Any& _repeatcount ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _repeatcount != maRepeatCount ) { maRepeatCount = _repeatcount; - fireChangeListener(); + fireChangeListener(l); } } @@ -1026,7 +1024,7 @@ void SAL_CALL AnimationNode::setRepeatCount( const Any& _repeatcount ) // XAnimationNode Any SAL_CALL AnimationNode::getRepeatDuration() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maRepeatDuration; } @@ -1034,11 +1032,11 @@ Any SAL_CALL AnimationNode::getRepeatDuration() // XAnimationNode void SAL_CALL AnimationNode::setRepeatDuration( const Any& _repeatduration ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _repeatduration != maRepeatDuration ) { maRepeatDuration = _repeatduration; - fireChangeListener(); + fireChangeListener(l); } } @@ -1046,7 +1044,7 @@ void SAL_CALL AnimationNode::setRepeatDuration( const Any& _repeatduration ) // XAnimationNode sal_Int16 SAL_CALL AnimationNode::getFill() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnFill; } @@ -1054,11 +1052,11 @@ sal_Int16 SAL_CALL AnimationNode::getFill() // XAnimationNode void SAL_CALL AnimationNode::setFill( sal_Int16 _fill ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _fill != mnFill ) { mnFill = _fill; - fireChangeListener(); + fireChangeListener(l); } } @@ -1066,7 +1064,7 @@ void SAL_CALL AnimationNode::setFill( sal_Int16 _fill ) // XAnimationNode sal_Int16 SAL_CALL AnimationNode::getFillDefault() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnFillDefault; } @@ -1074,11 +1072,11 @@ sal_Int16 SAL_CALL AnimationNode::getFillDefault() // XAnimationNode void SAL_CALL AnimationNode::setFillDefault( sal_Int16 _filldefault ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _filldefault != mnFillDefault ) { mnFillDefault = _filldefault; - fireChangeListener(); + fireChangeListener(l); } } @@ -1086,7 +1084,7 @@ void SAL_CALL AnimationNode::setFillDefault( sal_Int16 _filldefault ) // XAnimationNode sal_Int16 SAL_CALL AnimationNode::getRestart() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnRestart; } @@ -1094,11 +1092,11 @@ sal_Int16 SAL_CALL AnimationNode::getRestart() // XAnimationNode void SAL_CALL AnimationNode::setRestart( sal_Int16 _restart ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _restart != mnRestart ) { mnRestart = _restart; - fireChangeListener(); + fireChangeListener(l); } } @@ -1106,7 +1104,7 @@ void SAL_CALL AnimationNode::setRestart( sal_Int16 _restart ) // XAnimationNode sal_Int16 SAL_CALL AnimationNode::getRestartDefault() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnRestartDefault; } @@ -1114,11 +1112,11 @@ sal_Int16 SAL_CALL AnimationNode::getRestartDefault() // XAnimationNode void SAL_CALL AnimationNode::setRestartDefault( sal_Int16 _restartdefault ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _restartdefault != mnRestartDefault ) { mnRestartDefault = _restartdefault; - fireChangeListener(); + fireChangeListener(l); } } @@ -1126,7 +1124,7 @@ void SAL_CALL AnimationNode::setRestartDefault( sal_Int16 _restartdefault ) // XAnimationNode double SAL_CALL AnimationNode::getAcceleration() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mfAcceleration; } @@ -1134,11 +1132,11 @@ double SAL_CALL AnimationNode::getAcceleration() // XAnimationNode void SAL_CALL AnimationNode::setAcceleration( double _acceleration ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _acceleration != mfAcceleration ) { mfAcceleration = _acceleration; - fireChangeListener(); + fireChangeListener(l); } } @@ -1146,7 +1144,7 @@ void SAL_CALL AnimationNode::setAcceleration( double _acceleration ) // XAnimationNode double SAL_CALL AnimationNode::getDecelerate() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mfDecelerate; } @@ -1154,11 +1152,11 @@ double SAL_CALL AnimationNode::getDecelerate() // XAnimationNode void SAL_CALL AnimationNode::setDecelerate( double _decelerate ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _decelerate != mfDecelerate ) { mfDecelerate = _decelerate; - fireChangeListener(); + fireChangeListener(l); } } @@ -1166,7 +1164,7 @@ void SAL_CALL AnimationNode::setDecelerate( double _decelerate ) // XAnimationNode sal_Bool SAL_CALL AnimationNode::getAutoReverse() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mbAutoReverse; } @@ -1174,34 +1172,34 @@ sal_Bool SAL_CALL AnimationNode::getAutoReverse() // XAnimationNode void SAL_CALL AnimationNode::setAutoReverse( sal_Bool _autoreverse ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( bool(_autoreverse) != mbAutoReverse ) { mbAutoReverse = _autoreverse; - fireChangeListener(); + fireChangeListener(l); } } Sequence< NamedValue > SAL_CALL AnimationNode::getUserData() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maUserData; } void SAL_CALL AnimationNode::setUserData( const Sequence< NamedValue >& _userdata ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maUserData = _userdata; - fireChangeListener(); + fireChangeListener(l); } // XChild Reference< XInterface > SAL_CALL AnimationNode::getParent() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return static_cast<cppu::OWeakObject*>(mxParent.get().get()); } @@ -1209,14 +1207,14 @@ Reference< XInterface > SAL_CALL AnimationNode::getParent() // XChild void SAL_CALL AnimationNode::setParent( const Reference< XInterface >& Parent ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( Parent.get() != static_cast<cppu::OWeakObject*>(mxParent.get().get()) ) { rtl::Reference<AnimationNode> xParent = dynamic_cast<AnimationNode*>(Parent.get()); mxParent = xParent.get(); assert(bool(xParent) == bool(Parent) && "only support AnimationNode subtypes"); - fireChangeListener(); + fireChangeListener(l); } } @@ -1224,7 +1222,7 @@ void SAL_CALL AnimationNode::setParent( const Reference< XInterface >& Parent ) // XCloneable Reference< XCloneable > SAL_CALL AnimationNode::createClone() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); Reference< XCloneable > xNewNode; try @@ -1265,7 +1263,7 @@ Reference< XCloneable > SAL_CALL AnimationNode::createClone() // XAnimate Any SAL_CALL AnimationNode::getTarget() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maTarget; } @@ -1273,11 +1271,11 @@ Any SAL_CALL AnimationNode::getTarget() // XAnimate void SAL_CALL AnimationNode::setTarget( const Any& _target ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _target != maTarget ) { maTarget= _target; - fireChangeListener(); + fireChangeListener(l); } } @@ -1285,7 +1283,7 @@ void SAL_CALL AnimationNode::setTarget( const Any& _target ) // XAnimate OUString SAL_CALL AnimationNode::getAttributeName() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maAttributeName; } @@ -1293,11 +1291,11 @@ OUString SAL_CALL AnimationNode::getAttributeName() // XAnimate void SAL_CALL AnimationNode::setAttributeName( const OUString& _attribute ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _attribute != maAttributeName ) { maAttributeName = _attribute; - fireChangeListener(); + fireChangeListener(l); } } @@ -1305,7 +1303,7 @@ void SAL_CALL AnimationNode::setAttributeName( const OUString& _attribute ) // XAnimate Sequence< Any > SAL_CALL AnimationNode::getValues() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maValues; } @@ -1313,16 +1311,16 @@ Sequence< Any > SAL_CALL AnimationNode::getValues() // XAnimate void SAL_CALL AnimationNode::setValues( const Sequence< Any >& _values ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maValues = _values; - fireChangeListener(); + fireChangeListener(l); } // XAnimate sal_Int16 SAL_CALL AnimationNode::getSubItem() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnSubItem; } @@ -1330,11 +1328,11 @@ sal_Int16 SAL_CALL AnimationNode::getSubItem() // XAnimate void SAL_CALL AnimationNode::setSubItem( sal_Int16 _subitem ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _subitem != mnSubItem ) { mnSubItem = _subitem; - fireChangeListener(); + fireChangeListener(l); } } @@ -1342,7 +1340,7 @@ void SAL_CALL AnimationNode::setSubItem( sal_Int16 _subitem ) // XAnimate Sequence< double > SAL_CALL AnimationNode::getKeyTimes() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maKeyTimes; } @@ -1350,27 +1348,27 @@ Sequence< double > SAL_CALL AnimationNode::getKeyTimes() // XAnimate void SAL_CALL AnimationNode::setKeyTimes( const Sequence< double >& _keytimes ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maKeyTimes = _keytimes; - fireChangeListener(); + fireChangeListener(l); } // XAnimate sal_Int16 SAL_CALL AnimationNode::getValueType() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnValueType; } void SAL_CALL AnimationNode::setValueType( sal_Int16 _valuetype ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _valuetype != mnValueType ) { mnValueType = _valuetype; - fireChangeListener(); + fireChangeListener(l); } } @@ -1378,7 +1376,7 @@ void SAL_CALL AnimationNode::setValueType( sal_Int16 _valuetype ) // XAnimate sal_Int16 SAL_CALL AnimationNode::getCalcMode() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnCalcMode; } @@ -1386,11 +1384,11 @@ sal_Int16 SAL_CALL AnimationNode::getCalcMode() // XAnimate void SAL_CALL AnimationNode::setCalcMode( sal_Int16 _calcmode ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _calcmode != mnCalcMode ) { mnCalcMode = _calcmode; - fireChangeListener(); + fireChangeListener(l); } } @@ -1398,7 +1396,7 @@ void SAL_CALL AnimationNode::setCalcMode( sal_Int16 _calcmode ) // XAnimate sal_Bool SAL_CALL AnimationNode::getAccumulate() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mbAccumulate; } @@ -1406,11 +1404,11 @@ sal_Bool SAL_CALL AnimationNode::getAccumulate() // XAnimate void SAL_CALL AnimationNode::setAccumulate( sal_Bool _accumulate ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( bool(_accumulate) != mbAccumulate ) { mbAccumulate = _accumulate; - fireChangeListener(); + fireChangeListener(l); } } @@ -1418,7 +1416,7 @@ void SAL_CALL AnimationNode::setAccumulate( sal_Bool _accumulate ) // XAnimate sal_Int16 SAL_CALL AnimationNode::getAdditive() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnAdditive; } @@ -1426,11 +1424,11 @@ sal_Int16 SAL_CALL AnimationNode::getAdditive() // XAnimate void SAL_CALL AnimationNode::setAdditive( sal_Int16 _additive ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _additive != mnAdditive ) { mnAdditive = _additive; - fireChangeListener(); + fireChangeListener(l); } } @@ -1438,7 +1436,7 @@ void SAL_CALL AnimationNode::setAdditive( sal_Int16 _additive ) // XAnimate Any SAL_CALL AnimationNode::getFrom() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maFrom; } @@ -1446,11 +1444,11 @@ Any SAL_CALL AnimationNode::getFrom() // XAnimate void SAL_CALL AnimationNode::setFrom( const Any& _from ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _from != maFrom ) { maFrom = _from; - fireChangeListener(); + fireChangeListener(l); } } @@ -1458,7 +1456,7 @@ void SAL_CALL AnimationNode::setFrom( const Any& _from ) // XAnimate Any SAL_CALL AnimationNode::getTo() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maTo; } @@ -1466,11 +1464,11 @@ Any SAL_CALL AnimationNode::getTo() // XAnimate void SAL_CALL AnimationNode::setTo( const Any& _to ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _to != maTo ) { maTo = _to; - fireChangeListener(); + fireChangeListener(l); } } @@ -1478,7 +1476,7 @@ void SAL_CALL AnimationNode::setTo( const Any& _to ) // XAnimate Any SAL_CALL AnimationNode::getBy() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maBy; } @@ -1486,11 +1484,11 @@ Any SAL_CALL AnimationNode::getBy() // XAnimate void SAL_CALL AnimationNode::setBy( const Any& _by ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _by != maBy ) { maBy = _by; - fireChangeListener(); + fireChangeListener(l); } } @@ -1498,7 +1496,7 @@ void SAL_CALL AnimationNode::setBy( const Any& _by ) // XAnimate Sequence< TimeFilterPair > SAL_CALL AnimationNode::getTimeFilter() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maTimeFilter; } @@ -1506,26 +1504,26 @@ Sequence< TimeFilterPair > SAL_CALL AnimationNode::getTimeFilter() // XAnimate void SAL_CALL AnimationNode::setTimeFilter( const Sequence< TimeFilterPair >& _timefilter ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maTimeFilter = _timefilter; - fireChangeListener(); + fireChangeListener(l); } OUString SAL_CALL AnimationNode::getFormula() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maFormula; } void SAL_CALL AnimationNode::setFormula( const OUString& _formula ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _formula != maFormula ) { maFormula = _formula; - fireChangeListener(); + fireChangeListener(l); } } @@ -1533,7 +1531,7 @@ void SAL_CALL AnimationNode::setFormula( const OUString& _formula ) // XAnimateColor sal_Int16 SAL_CALL AnimationNode::getColorInterpolation() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnColorSpace; } @@ -1541,11 +1539,11 @@ sal_Int16 SAL_CALL AnimationNode::getColorInterpolation() // XAnimateColor void SAL_CALL AnimationNode::setColorInterpolation( sal_Int16 _colorspace ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _colorspace != mnColorSpace ) { mnColorSpace = _colorspace; - fireChangeListener(); + fireChangeListener(l); } } @@ -1553,7 +1551,7 @@ void SAL_CALL AnimationNode::setColorInterpolation( sal_Int16 _colorspace ) // XAnimateColor sal_Bool SAL_CALL AnimationNode::getDirection() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mbDirection; } @@ -1561,11 +1559,11 @@ sal_Bool SAL_CALL AnimationNode::getDirection() // XAnimateColor void SAL_CALL AnimationNode::setDirection( sal_Bool _direction ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( bool(_direction) != mbDirection ) { mbDirection = _direction; - fireChangeListener(); + fireChangeListener(l); } } @@ -1573,7 +1571,7 @@ void SAL_CALL AnimationNode::setDirection( sal_Bool _direction ) // XAnimateMotion Any SAL_CALL AnimationNode::getPath() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maPath; } @@ -1581,16 +1579,16 @@ Any SAL_CALL AnimationNode::getPath() // XAnimateMotion void SAL_CALL AnimationNode::setPath( const Any& _path ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maPath = _path; - fireChangeListener(); + fireChangeListener(l); } // XAnimateMotion Any SAL_CALL AnimationNode::getOrigin() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maOrigin; } @@ -1598,15 +1596,15 @@ Any SAL_CALL AnimationNode::getOrigin() // XAnimateMotion void SAL_CALL AnimationNode::setOrigin( const Any& _origin ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maOrigin = _origin; - fireChangeListener(); + fireChangeListener(l); } // XAnimatePhysics Any SAL_CALL AnimationNode::getStartVelocityX() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maStartVelocityX; } @@ -1614,15 +1612,15 @@ Any SAL_CALL AnimationNode::getStartVelocityX() // XAnimatePhysics void SAL_CALL AnimationNode::setStartVelocityX( const Any& _startvelocityx ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maStartVelocityX = _startvelocityx; - fireChangeListener(); + fireChangeListener(l); } // XAnimatePhysics Any SAL_CALL AnimationNode::getStartVelocityY() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maStartVelocityY; } @@ -1630,16 +1628,16 @@ Any SAL_CALL AnimationNode::getStartVelocityY() // XAnimatePhysics void SAL_CALL AnimationNode::setStartVelocityY( const Any& _startvelocityy ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maStartVelocityY = _startvelocityy; - fireChangeListener(); + fireChangeListener(l); } // XAnimatePhysics Any SAL_CALL AnimationNode::getDensity() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maDensity; } @@ -1647,16 +1645,16 @@ Any SAL_CALL AnimationNode::getDensity() // XAnimatePhysics void SAL_CALL AnimationNode::setDensity( const Any& _density ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maDensity = _density; - fireChangeListener(); + fireChangeListener(l); } // XAnimatePhysics Any SAL_CALL AnimationNode::getBounciness() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maBounciness; } @@ -1664,16 +1662,16 @@ Any SAL_CALL AnimationNode::getBounciness() // XAnimatePhysics void SAL_CALL AnimationNode::setBounciness( const Any& _bounciness ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maBounciness = _bounciness; - fireChangeListener(); + fireChangeListener(l); } // XAnimateTransform sal_Int16 SAL_CALL AnimationNode::getTransformType() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnTransformType; } @@ -1681,11 +1679,11 @@ sal_Int16 SAL_CALL AnimationNode::getTransformType() // XAnimateTransform void SAL_CALL AnimationNode::setTransformType( sal_Int16 _transformtype ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _transformtype != mnTransformType ) { mnTransformType = _transformtype; - fireChangeListener(); + fireChangeListener(l); } } @@ -1693,7 +1691,7 @@ void SAL_CALL AnimationNode::setTransformType( sal_Int16 _transformtype ) // XTransitionFilter sal_Int16 SAL_CALL AnimationNode::getTransition() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnTransition; } @@ -1701,11 +1699,11 @@ sal_Int16 SAL_CALL AnimationNode::getTransition() // XTransitionFilter void SAL_CALL AnimationNode::setTransition( sal_Int16 _transition ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _transition != mnTransition ) { mnTransition = _transition; - fireChangeListener(); + fireChangeListener(l); } } @@ -1713,7 +1711,7 @@ void SAL_CALL AnimationNode::setTransition( sal_Int16 _transition ) // XTransitionFilter sal_Int16 SAL_CALL AnimationNode::getSubtype() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnSubtype; } @@ -1721,11 +1719,11 @@ sal_Int16 SAL_CALL AnimationNode::getSubtype() // XTransitionFilter void SAL_CALL AnimationNode::setSubtype( sal_Int16 _subtype ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _subtype != mnSubtype ) { mnSubtype = _subtype; - fireChangeListener(); + fireChangeListener(l); } } @@ -1733,7 +1731,7 @@ void SAL_CALL AnimationNode::setSubtype( sal_Int16 _subtype ) // XTransitionFilter sal_Bool SAL_CALL AnimationNode::getMode() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mbMode; } @@ -1741,11 +1739,11 @@ sal_Bool SAL_CALL AnimationNode::getMode() // XTransitionFilter void SAL_CALL AnimationNode::setMode( sal_Bool _mode ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( bool(_mode) != mbMode ) { mbMode = _mode; - fireChangeListener(); + fireChangeListener(l); } } @@ -1753,7 +1751,7 @@ void SAL_CALL AnimationNode::setMode( sal_Bool _mode ) // XTransitionFilter sal_Int32 SAL_CALL AnimationNode::getFadeColor() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnFadeColor; } @@ -1761,11 +1759,11 @@ sal_Int32 SAL_CALL AnimationNode::getFadeColor() // XTransitionFilter void SAL_CALL AnimationNode::setFadeColor( sal_Int32 _fadecolor ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _fadecolor != mnFadeColor ) { mnFadeColor = _fadecolor; - fireChangeListener(); + fireChangeListener(l); } } @@ -1773,7 +1771,7 @@ void SAL_CALL AnimationNode::setFadeColor( sal_Int32 _fadecolor ) // XAudio Any SAL_CALL AnimationNode::getSource() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maTarget; } @@ -1781,16 +1779,16 @@ Any SAL_CALL AnimationNode::getSource() // XAudio void SAL_CALL AnimationNode::setSource( const Any& _source ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maTarget = _source; - fireChangeListener(); + fireChangeListener(l); } // XAudio double SAL_CALL AnimationNode::getVolume() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mfVolume; } @@ -1798,50 +1796,50 @@ double SAL_CALL AnimationNode::getVolume() // XAudio void SAL_CALL AnimationNode::setVolume( double _volume ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _volume != mfVolume ) { mfVolume = _volume; - fireChangeListener(); + fireChangeListener(l); } } sal_Bool SAL_CALL AnimationNode::getHideDuringShow() { - osl::Guard<osl::Mutex> aGuard(m_aMutex); + std::unique_lock aGuard(m_aMutex); return mbHideDuringShow; } void SAL_CALL AnimationNode::setHideDuringShow(sal_Bool bHideDuringShow) { - osl::Guard<osl::Mutex> aGuard(m_aMutex); + std::unique_lock l(m_aMutex); if (static_cast<bool>(bHideDuringShow) != mbHideDuringShow) { mbHideDuringShow = bHideDuringShow; - fireChangeListener(); + fireChangeListener(l); } } sal_Bool SAL_CALL AnimationNode::getNarration() { - osl::Guard<osl::Mutex> aGuard(m_aMutex); + std::unique_lock aGuard(m_aMutex); return mbNarration; } void SAL_CALL AnimationNode::setNarration(sal_Bool bNarration) { - osl::Guard<osl::Mutex> aGuard(m_aMutex); + std::unique_lock l(m_aMutex); if (static_cast<bool>(bNarration) != mbNarration) { mbNarration = bNarration; - fireChangeListener(); + fireChangeListener(l); } } // XCommand sal_Int16 SAL_CALL AnimationNode::getCommand() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnCommand; } @@ -1849,11 +1847,11 @@ sal_Int16 SAL_CALL AnimationNode::getCommand() // XCommand void SAL_CALL AnimationNode::setCommand( sal_Int16 _command ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _command != mnCommand ) { mnCommand = _command; - fireChangeListener(); + fireChangeListener(l); } } @@ -1861,7 +1859,7 @@ void SAL_CALL AnimationNode::setCommand( sal_Int16 _command ) // XCommand Any SAL_CALL AnimationNode::getParameter() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maParameter; } @@ -1869,9 +1867,9 @@ Any SAL_CALL AnimationNode::getParameter() // XCommand void SAL_CALL AnimationNode::setParameter( const Any& _parameter ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); maParameter = _parameter; - fireChangeListener(); + fireChangeListener(l); } @@ -1885,7 +1883,7 @@ Type SAL_CALL AnimationNode::getElementType() // XElementAccess sal_Bool SAL_CALL AnimationNode::hasElements() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return !maChildren.empty(); } @@ -1893,7 +1891,7 @@ sal_Bool SAL_CALL AnimationNode::hasElements() // XEnumerationAccess Reference< XEnumeration > SAL_CALL AnimationNode::createEnumeration() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return new TimeContainerEnumeration(std::vector(maChildren)); } @@ -1902,7 +1900,7 @@ Reference< XEnumeration > SAL_CALL AnimationNode::createEnumeration() // XTimeContainer Reference< XAnimationNode > SAL_CALL AnimationNode::insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( !newChild.is() || !refChild.is() ) throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject*>(this), -1); @@ -1917,6 +1915,7 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::insertBefore( const Referenc maChildren.insert( before, newChild ); Reference< XInterface > xThis( static_cast< OWeakObject * >(this) ); + l.unlock(); newChild->setParent( xThis ); return newChild; @@ -1926,7 +1925,7 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::insertBefore( const Referenc // XTimeContainer Reference< XAnimationNode > SAL_CALL AnimationNode::insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( !newChild.is() || !refChild.is() ) throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject*>(this), -1); @@ -1945,6 +1944,7 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::insertAfter( const Reference maChildren.push_back( newChild ); Reference< XInterface > xThis( static_cast< OWeakObject * >(this) ); + l.unlock(); newChild->setParent( xThis ); return newChild; @@ -1954,7 +1954,7 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::insertAfter( const Reference // XTimeContainer Reference< XAnimationNode > SAL_CALL AnimationNode::replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( !newChild.is() || !oldChild.is() ) throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject*>(this), -1); @@ -1966,11 +1966,11 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::replaceChild( const Referenc if( replace == maChildren.end() ) throw NoSuchElementException(); - oldChild->setParent( Reference< XInterface >() ); - (*replace) = newChild; Reference< XInterface > xThis( static_cast< OWeakObject * >(this) ); + l.unlock(); + oldChild->setParent( Reference< XInterface >() ); newChild->setParent( xThis ); return newChild; @@ -1980,7 +1980,7 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::replaceChild( const Referenc // XTimeContainer Reference< XAnimationNode > SAL_CALL AnimationNode::removeChild( const Reference< XAnimationNode >& oldChild ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( !oldChild.is() ) throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject*>(this), 1); @@ -1989,10 +1989,11 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::removeChild( const Reference if( old == maChildren.end() ) throw NoSuchElementException(); - oldChild->setParent( Reference< XInterface >() ); - maChildren.erase( old ); + l.unlock(); + oldChild->setParent( Reference< XInterface >() ); + return oldChild; } @@ -2002,7 +2003,7 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::appendChild( const Reference { Reference< XInterface > xThis( static_cast< OWeakObject * >(this) ); { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if( !newChild.is() ) throw IllegalArgumentException("no child", xThis, 1); @@ -2024,7 +2025,7 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::appendChild( const Reference // XIterateContainer sal_Int16 SAL_CALL AnimationNode::getIterateType() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mnIterateType; } @@ -2032,11 +2033,11 @@ sal_Int16 SAL_CALL AnimationNode::getIterateType() // XIterateContainer void SAL_CALL AnimationNode::setIterateType( sal_Int16 _iteratetype ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _iteratetype != mnIterateType ) { mnIterateType = _iteratetype; - fireChangeListener(); + fireChangeListener(l); } } @@ -2044,7 +2045,7 @@ void SAL_CALL AnimationNode::setIterateType( sal_Int16 _iteratetype ) // XIterateContainer double SAL_CALL AnimationNode::getIterateInterval() { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mfIterateInterval; } @@ -2052,11 +2053,11 @@ double SAL_CALL AnimationNode::getIterateInterval() // XIterateContainer void SAL_CALL AnimationNode::setIterateInterval( double _iterateinterval ) { - Guard< Mutex > aGuard( m_aMutex ); + std::unique_lock l( m_aMutex ); if( _iterateinterval != mfIterateInterval ) { mfIterateInterval = _iterateinterval; - fireChangeListener(); + fireChangeListener(l); } } @@ -2064,22 +2065,22 @@ void SAL_CALL AnimationNode::setIterateInterval( double _iterateinterval ) // XChangesNotifier void SAL_CALL AnimationNode::addChangesListener( const Reference< XChangesListener >& aListener ) { - maChangeListener.addInterface( aListener ); + std::unique_lock l( m_aMutex ); + maChangeListener.addInterface( l, aListener ); } // XChangesNotifier void SAL_CALL AnimationNode::removeChangesListener( const Reference< XChangesListener >& aListener ) { - maChangeListener.removeInterface(aListener); + std::unique_lock l( m_aMutex ); + maChangeListener.removeInterface(l, aListener); } -void AnimationNode::fireChangeListener() +void AnimationNode::fireChangeListener(std::unique_lock<std::mutex>& l) { - Guard< Mutex > aGuard( m_aMutex ); - - OInterfaceIteratorHelper3 aIterator( maChangeListener ); + OInterfaceIteratorHelper4 aIterator( l, maChangeListener ); if( aIterator.hasMoreElements() ) { Reference< XInterface > xSource( static_cast<OWeakObject*>(this), UNO_QUERY ); @@ -2092,7 +2093,11 @@ void AnimationNode::fireChangeListener() //fdo#69645 use WeakReference of mxParent to test if mpParent is still valid rtl::Reference<AnimationNode> xGuard(mxParent); if (xGuard.is()) - xGuard->fireChangeListener(); + { + l.unlock(); + std::unique_lock l2(xGuard->m_aMutex); + xGuard->fireChangeListener(l2); + } } |