summaryrefslogtreecommitdiff
path: root/include/unotools/weakref.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-02-21 16:00:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-22 12:27:55 +0100
commit27352b81638f2f1e792ab48ec532eaacf6f61718 (patch)
treeeb744c30643272b219d59f2782ffc96f62bf379c /include/unotools/weakref.hxx
parent6ccdd0d164b16da9a13ab5d8290a1a0f041caaf7 (diff)
Add XWeak constructor and operator= to uno::WeakReference
which is faster since we can skip the UNO_QUERY. Change-Id: Id95ad9f3568213e974bd13659d92d4ea94dbfbd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130282 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/unotools/weakref.hxx')
-rw-r--r--include/unotools/weakref.hxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/unotools/weakref.hxx b/include/unotools/weakref.hxx
index 189df22d5359..ca5682416033 100644
--- a/include/unotools/weakref.hxx
+++ b/include/unotools/weakref.hxx
@@ -77,14 +77,22 @@ public:
{
}
- /** Copy ctor. Initialize this reference with a hard reference.
+ /** Copy ctor. Initialize this reference with a hard reference.
@param rRef another hard ref
*/
+#if defined LIBO_INTERNAL_ONLY
+ WeakReference(interface_type* pRef)
+ : WeakReferenceHelper(
+ css::uno::Reference<css::uno::XWeak>(static_cast<cppu::OWeakObject*>(pRef)))
+ {
+ }
+#else
WeakReference(interface_type* pRef)
: WeakReferenceHelper(static_cast<cppu::OWeakObject*>(pRef))
{
}
+#endif
/** Releases this reference and takes over hard reference xInt.
If the implementation behind xInt does not support XWeak
@@ -106,7 +114,8 @@ public:
WeakReference& operator=(interface_type* pInt)
{
- WeakReferenceHelper::operator=(static_cast<::cppu::OWeakObject*>(pInt));
+ WeakReferenceHelper::operator=(
+ css::uno::Reference<css::uno::XWeak>(static_cast<::cppu::OWeakObject*>(pInt)));
return *this;
}