summaryrefslogtreecommitdiff
path: root/include/com
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-12-02 12:58:50 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-12-03 06:37:51 +0000
commit73ed1178034fb391882d348f99699579cdff643a (patch)
tree8b0e0a5173e260124abf4938e722bde11824fec0 /include/com
parentde9d0e797903e7ecc19be2b05c7e89d5936ae02d (diff)
add move assignment and constructor to uno::Reference
"perf stat" says: Before 14,009,233,975,201 cycles After 13,660,876,595,941 cycles i.e. shaved roughly 2% of the cycles Change-Id: If604a125a8a5040281abd699678d0c791d5bbb51 Reviewed-on: https://gerrit.libreoffice.org/20350 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'include/com')
-rw-r--r--include/com/sun/star/uno/Reference.h16
-rw-r--r--include/com/sun/star/uno/Reference.hxx21
2 files changed, 37 insertions, 0 deletions
diff --git a/include/com/sun/star/uno/Reference.h b/include/com/sun/star/uno/Reference.h
index ba0868846702..8e266cd72f43 100644
--- a/include/com/sun/star/uno/Reference.h
+++ b/include/com/sun/star/uno/Reference.h
@@ -293,6 +293,14 @@ public:
*/
inline Reference( const Reference< interface_type > & rRef );
+#if defined LIBO_INTERNAL_ONLY
+ /** Move constructor
+
+ @param rRef another reference
+ */
+ inline Reference( Reference< interface_type > && rRef );
+#endif
+
/** Up-casting conversion constructor: Copies interface reference.
Does not work for up-casts to ambiguous bases. For the special case of
@@ -540,7 +548,15 @@ public:
@return this reference
*/
inline Reference< interface_type > & SAL_CALL operator = ( const Reference< interface_type > & rRef );
+#if defined LIBO_INTERNAL_ONLY
+ /** Assignment move operator: Acquires given interface reference and sets reference.
+ An interface already set will be released.
+ @param rRef an interface reference
+ @return this reference
+ */
+ inline Reference< interface_type > & SAL_CALL operator = ( Reference< interface_type > && rRef );
+#endif
/** Queries given interface reference for type interface_type.
@param rRef interface reference
diff --git a/include/com/sun/star/uno/Reference.hxx b/include/com/sun/star/uno/Reference.hxx
index 498d5be4b46d..b25083d8e030 100644
--- a/include/com/sun/star/uno/Reference.hxx
+++ b/include/com/sun/star/uno/Reference.hxx
@@ -124,6 +124,15 @@ inline Reference< interface_type >::Reference( const Reference< interface_type >
_pInterface->acquire();
}
+#if defined LIBO_INTERNAL_ONLY
+template< class interface_type >
+inline Reference< interface_type >::Reference( Reference< interface_type > && rRef )
+{
+ _pInterface = rRef._pInterface;
+ rRef._pInterface = nullptr;
+}
+#endif
+
template< class interface_type > template< class derived_type >
inline Reference< interface_type >::Reference(
const Reference< derived_type > & rRef,
@@ -341,6 +350,18 @@ inline Reference< interface_type > & Reference< interface_type >::operator = (
return *this;
}
+#if defined LIBO_INTERNAL_ONLY
+template< class interface_type >
+inline Reference< interface_type > & Reference< interface_type >::operator = (
+ Reference< interface_type > && rRef )
+{
+ if (_pInterface)
+ _pInterface->release();
+ _pInterface = rRef._pInterface;
+ rRef._pInterface = nullptr;
+ return *this;
+}
+#endif
template< class interface_type >
inline Reference< interface_type > Reference< interface_type >::query(