summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-27 19:05:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-27 20:57:37 +0100
commit1606f778e4cd3d8056aecbac3d13f5858361356a (patch)
treea5b52ef79126152e1ebb3fefe09bc4a2dff68a5b /include/comphelper
parentdbc411773457aeb9e740a61325845469c8b5603e (diff)
reduce default cost of OInterfaceContainerHelper4
most of these are never used, so rather store a pointer to a shared empty vector Change-Id: I4736794a31237c598d1188ef42f4210ea6d3f871 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127599 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/interfacecontainer4.hxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/comphelper/interfacecontainer4.hxx b/include/comphelper/interfacecontainer4.hxx
index 04fafeadc0fd..e58b958629b9 100644
--- a/include/comphelper/interfacecontainer4.hxx
+++ b/include/comphelper/interfacecontainer4.hxx
@@ -114,7 +114,8 @@ template <class ListenerT> void OInterfaceIteratorHelper4<ListenerT>::remove()
template <class ListenerT> class OInterfaceContainerHelper4
{
public:
- OInterfaceContainerHelper4() {}
+ OInterfaceContainerHelper4();
+
/**
Return the number of Elements in the container. Only useful if you have acquired
the mutex.
@@ -205,6 +206,12 @@ private:
OInterfaceContainerHelper4(const OInterfaceContainerHelper4&) = delete;
OInterfaceContainerHelper4& operator=(const OInterfaceContainerHelper4&) = delete;
+ static o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>>& DEFAULT()
+ {
+ static o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>> SINGLETON;
+ return SINGLETON;
+ }
+
private:
template <typename EventT> class NotifySingleListener
{
@@ -228,6 +235,12 @@ private:
};
template <class T>
+inline OInterfaceContainerHelper4<T>::OInterfaceContainerHelper4()
+ : maData(OInterfaceContainerHelper4<T>::DEFAULT())
+{
+}
+
+template <class T>
template <typename FuncT>
inline void OInterfaceContainerHelper4<T>::forEach(FuncT const& func)
{