diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-07-03 20:26:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-05 19:00:45 +0200 |
commit | 6cb400f41df0dd108cdb4b4d3ec6656844814147 (patch) | |
tree | 15a38de0d82d59be10a74d6cdc5375e9c08b0dd6 /svl | |
parent | b99e8c79bf630432fbb6a819d69da0bd2db7c80c (diff) |
store the SfxItemSet inside SfxSetItem by value
rather than on the heap, avoiding an allocation
Change-Id: I3f1504f9a2d4178a9ba59e98de182a0ab98cdce0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118356
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/itempool.cxx | 1 | ||||
-rw-r--r-- | svl/source/items/itemset.cxx | 1 | ||||
-rw-r--r-- | svl/source/items/sitem.cxx | 14 |
3 files changed, 10 insertions, 6 deletions
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 6d090d8556bd..b23ef665c899 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -18,6 +18,7 @@ */ #include <svl/itempool.hxx> +#include <svl/setitem.hxx> #include <string.h> #include <libxml/xmlwriter.h> diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index 5b986167686f..7fb88175590d 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -28,6 +28,7 @@ #include <sal/log.hxx> #include <svl/itemset.hxx> +#include <svl/itemset.hxx> #include <svl/itempool.hxx> #include <svl/itemiter.hxx> #include <svl/setitem.hxx> diff --git a/svl/source/items/sitem.cxx b/svl/source/items/sitem.cxx index 57eb5436ea56..c4734d35c2f2 100644 --- a/svl/source/items/sitem.cxx +++ b/svl/source/items/sitem.cxx @@ -29,23 +29,25 @@ SfxSetItem::SfxSetItem( sal_uInt16 which, const SfxItemSet &rSet) : SfxPoolItem(which), - pSet(rSet.Clone()) + maSet(rSet) { + assert(!dynamic_cast<const SfxAllItemSet*>(&rSet) && "cannot handle SfxAllItemSet here"); } -SfxSetItem::SfxSetItem( sal_uInt16 which, std::unique_ptr<SfxItemSet> &&pS) : +SfxSetItem::SfxSetItem( sal_uInt16 which, SfxItemSet &&pS) : SfxPoolItem(which), - pSet(std::move(pS)) + maSet(pS) { - DBG_ASSERT(pSet, "SfxSetItem without set constructed" ); + assert(!dynamic_cast<SfxAllItemSet*>(&pS) && "cannot handle SfxAllItemSet here"); } SfxSetItem::SfxSetItem( const SfxSetItem& rCopy, SfxItemPool *pPool ) : SfxPoolItem(rCopy), - pSet(rCopy.pSet->Clone(true, pPool)) + maSet(rCopy.maSet.CloneAsValue(true, pPool)) { + assert(!dynamic_cast<const SfxAllItemSet*>(&rCopy) && "cannot handle SfxAllItemSet here"); } @@ -57,7 +59,7 @@ SfxSetItem::~SfxSetItem() bool SfxSetItem::operator==( const SfxPoolItem& rCmp) const { assert(SfxPoolItem::operator==(rCmp)); - return *pSet == *static_cast<const SfxSetItem &>(rCmp).pSet; + return maSet == static_cast<const SfxSetItem &>(rCmp).maSet; } |