diff options
author | Michael Stahl <mst@openoffice.org> | 2010-01-08 22:22:08 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2010-01-08 22:22:08 +0100 |
commit | 0aab9a48358f905de8d65568e5f32e8d36d6021c (patch) | |
tree | 14ec4d8eff21f287375e79604e198adf4df388b9 /cppuhelper/source/weak.cxx | |
parent | d89afea42e33bb771cd9a31fbdc71b94ba4d8679 (diff) |
swunolocking1: #i108161#: WeakReferenceHelper::operator=():
avoid creating a temporary WeakReferenceHelper for uno::Reference assignment.
[according to callgrind this is 3 times faster]
Diffstat (limited to 'cppuhelper/source/weak.cxx')
-rw-r--r-- | cppuhelper/source/weak.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx index b518d2526e3b..1901610d40b7 100644 --- a/cppuhelper/source/weak.cxx +++ b/cppuhelper/source/weak.cxx @@ -481,11 +481,20 @@ WeakReferenceHelper::WeakReferenceHelper(const WeakReferenceHelper& rWeakRef) SA WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef) SAL_THROW( () ) { - try + if (this == &rWeakRef) { - if (this != &rWeakRef) + return *this; + } + Reference< XInterface > xInt( rWeakRef.get() ); + return operator = ( xInt ); +} + +WeakReferenceHelper & SAL_CALL +WeakReferenceHelper::operator= (const Reference< XInterface > & xInt) +SAL_THROW( () ) +{ + try { - Reference< XInterface > xInt( rWeakRef.get() ); if (m_pImpl) { if (m_pImpl->m_XWeakConnectionPoint.is()) @@ -502,7 +511,6 @@ WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& r m_pImpl->acquire(); } } - } catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected() return *this; } |