swunolocking1: #i108161#: WeakReferenceHelper::operator=():
avoid creating a temporary WeakReferenceHelper for uno::Reference assignment. [according to callgrind this is 3 times faster]
This commit is contained in:
@@ -79,13 +79,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
WeakReferenceHelper & SAL_CALL operator = ( const WeakReferenceHelper & rWeakRef ) SAL_THROW( () );
|
WeakReferenceHelper & SAL_CALL operator = ( const WeakReferenceHelper & rWeakRef ) SAL_THROW( () );
|
||||||
|
|
||||||
/** Releases this reference and takes over hard reference xInt. If the implementation behind
|
/** Releases this reference and takes over hard reference xInt.
|
||||||
xInt does not support XWeak or XInt is null, than this reference is null.
|
If the implementation behind xInt does not support XWeak
|
||||||
|
or XInt is null, then this reference is null.
|
||||||
|
|
||||||
@param xInt another hard reference
|
@param xInt another hard reference
|
||||||
*/
|
*/
|
||||||
inline WeakReferenceHelper & SAL_CALL operator = ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xInt ) SAL_THROW( () )
|
WeakReferenceHelper & SAL_CALL operator = (
|
||||||
{ return operator = ( WeakReferenceHelper( xInt ) ); }
|
const ::com::sun::star::uno::Reference<
|
||||||
|
::com::sun::star::uno::XInterface > & xInt ) SAL_THROW( () );
|
||||||
|
|
||||||
/** Returns true if both weak refs reference to the same object.
|
/** Returns true if both weak refs reference to the same object.
|
||||||
|
|
||||||
@@ -135,6 +137,17 @@ public:
|
|||||||
: WeakReferenceHelper( rRef )
|
: WeakReferenceHelper( rRef )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
/** Releases this reference and takes over hard reference xInt.
|
||||||
|
If the implementation behind xInt does not support XWeak
|
||||||
|
or XInt is null, then this reference is null.
|
||||||
|
|
||||||
|
@param xInt another hard reference
|
||||||
|
*/
|
||||||
|
WeakReference & SAL_CALL operator = (
|
||||||
|
const ::com::sun::star::uno::Reference< interface_type > & xInt )
|
||||||
|
SAL_THROW( () )
|
||||||
|
{ WeakReferenceHelper::operator=(xInt); return *this; }
|
||||||
|
|
||||||
/** Gets a hard reference to the object.
|
/** Gets a hard reference to the object.
|
||||||
|
|
||||||
@return hard reference or null, if the weakly referenced interface has gone
|
@return hard reference or null, if the weakly referenced interface has gone
|
||||||
|
@@ -383,4 +383,5 @@ UDK_3.6 { # OOo 3.0
|
|||||||
UDK_3.7 { # OOo 3.3
|
UDK_3.7 { # OOo 3.3
|
||||||
global:
|
global:
|
||||||
__1cEcppuLOWeakObjectbAdisposeWeakConnectionPoint6M_v_;
|
__1cEcppuLOWeakObjectbAdisposeWeakConnectionPoint6M_v_;
|
||||||
|
__1cDcomDsunEstarDunoTWeakReferenceHelper2G6Mrkn0DJReference4n0DKXInterface____r4_;
|
||||||
} UDK_3.6;
|
} UDK_3.6;
|
||||||
|
@@ -377,5 +377,6 @@ UDK_3.5 { # OOo 3.0
|
|||||||
UDK_3.6 { # OOo 3.3
|
UDK_3.6 { # OOo 3.3
|
||||||
global:
|
global:
|
||||||
_ZN4cppu11OWeakObject26disposeWeakConnectionPointEv;
|
_ZN4cppu11OWeakObject26disposeWeakConnectionPointEv;
|
||||||
|
_ZN3com3sun4star3uno19WeakReferenceHelperaSERKNS2_9ReferenceINS2_10XInterfaceEEE;
|
||||||
} UDK_3.5;
|
} UDK_3.5;
|
||||||
|
|
||||||
|
@@ -480,12 +480,21 @@ WeakReferenceHelper::WeakReferenceHelper(const WeakReferenceHelper& rWeakRef) SA
|
|||||||
}
|
}
|
||||||
|
|
||||||
WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef) SAL_THROW( () )
|
WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef) SAL_THROW( () )
|
||||||
|
{
|
||||||
|
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
|
try
|
||||||
{
|
{
|
||||||
if (this != &rWeakRef)
|
|
||||||
{
|
|
||||||
Reference< XInterface > xInt( rWeakRef.get() );
|
|
||||||
if (m_pImpl)
|
if (m_pImpl)
|
||||||
{
|
{
|
||||||
if (m_pImpl->m_XWeakConnectionPoint.is())
|
if (m_pImpl->m_XWeakConnectionPoint.is())
|
||||||
@@ -502,7 +511,6 @@ WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& r
|
|||||||
m_pImpl->acquire();
|
m_pImpl->acquire();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
|
catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user