diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-06-16 20:33:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-06-17 09:39:47 +0200 |
commit | 15cf55b0a6a504772b051d957a51e7c3bc2d2b38 (patch) | |
tree | 76d6d24c0365a1fe0318ac97f47444aa218290f9 /svl | |
parent | 5b419af59e30b3383930ec11e130aa1b09b0547e (diff) |
cid#1603617 Big parameter passed by value
and ~20 of similar warning
The current size of SfxItemSet is 144 bytes, and std::function is 32
bytes of that.
If we reintroduce Changed as a virtual method we can avoid the need for
this callback. All of the calculation work that was originally
unconditionally done, and then thrown away, was moved into the specific
SwAttrSet case of this so the other normal cases don't do any wasted
work anymore.
Change-Id: Ieec90f6d28dad8a6bf1cf8f402042812bd81c331
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168967
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/itemset.cxx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index 47831c009b85..251194194d11 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -271,7 +271,6 @@ SfxItemSet::SfxItemSet(SfxItemPool& rPool) #endif , m_aWhichRanges(rPool.GetMergedIdRanges()) , m_aPoolItemMap() -, m_aCallback() { #ifdef DBG_UTIL nAllocatedSfxItemSetCount++; @@ -289,7 +288,6 @@ SfxItemSet::SfxItemSet(SfxItemPool& pool, WhichRangesContainer wids) #endif , m_aWhichRanges(std::move(wids)) , m_aPoolItemMap() -, m_aCallback() { #ifdef DBG_UTIL nAllocatedSfxItemSetCount++; @@ -308,7 +306,6 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet ) #endif , m_aWhichRanges( rASet.m_aWhichRanges ) , m_aPoolItemMap() -, m_aCallback(rASet.m_aCallback) { #ifdef DBG_UTIL nAllocatedSfxItemSetCount++; @@ -334,7 +331,6 @@ SfxItemSet::SfxItemSet(SfxItemSet&& rASet) noexcept #endif , m_aWhichRanges( std::move(rASet.m_aWhichRanges) ) , m_aPoolItemMap( std::move(rASet.m_aPoolItemMap) ) -, m_aCallback(rASet.m_aCallback) { #ifdef DBG_UTIL nAllocatedSfxItemSetCount++; @@ -354,7 +350,6 @@ SfxItemSet::SfxItemSet(SfxItemSet&& rASet) noexcept rASet.m_pParent = nullptr; rASet.m_nRegister = 0; rASet.m_aWhichRanges.reset(); - rASet.m_aCallback = nullptr; assert(m_aWhichRanges.validRanges2()); } @@ -768,10 +763,7 @@ void SfxItemSet::ClearSingleItem_PrepareRemove(const SfxPoolItem* pItem) return; // Notification-Callback - if(m_aCallback) - { - m_aCallback(pItem, nullptr); - } + Changed(pItem, nullptr); // check register for remove checkRemovePoolRegistration(pItem); @@ -1000,10 +992,7 @@ const SfxPoolItem* SfxItemSet::PutImpl(const SfxPoolItem& rItem, bool bPassingOw const SfxPoolItem* pNew(implCreateItemEntry(*GetPool(), &rItem, bPassingOwnership)); // Notification-Callback - if(m_aCallback) - { - m_aCallback(pEntry, pNew); - } + Changed(pEntry, pNew); // check register for add/remove. add first so that unregister/register // is avoided when an Item is replaced (increase, decrease, do not reach 0) @@ -1330,6 +1319,13 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const } /** + * Notification callback + */ +void SfxItemSet::Changed(const SfxPoolItem*, const SfxPoolItem*) const +{ +} + +/** * Only retain the Items that are also present in rSet * (nevermind their value). */ |