diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-17 15:39:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-20 08:17:12 +0200 |
commit | bcb0c9b4bee1d943d9c60f9d4512dba901f85f54 (patch) | |
tree | 3b76714c3fa74fbcd4041d8ba6b60eee977e1030 /svl/source/inc | |
parent | ec7ba61a6164c805f5a71b077715b7e1521a2d62 (diff) |
flatten SfxItemPool_Impl (tdf#81765 related)
Flatten the vector of SfxPoolItemArray_Impl, to reduce pointer chasing.
This struct is movable, etc, so no need to allocate it separately on the
heap.
Change-Id: I794b4356660e9cd0e63bc98b011f58162a838662
Reviewed-on: https://gerrit.libreoffice.org/70884
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/source/inc')
-rw-r--r-- | svl/source/inc/poolio.hxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx index eb78be10e71a..8eef10c5af96 100644 --- a/svl/source/inc/poolio.hxx +++ b/svl/source/inc/poolio.hxx @@ -43,21 +43,22 @@ struct SfxPoolItemArray_Impl private: o3tl::sorted_vector<SfxPoolItem*> maPoolItemSet; public: - o3tl::sorted_vector<SfxPoolItem*>::const_iterator begin() { return maPoolItemSet.begin(); } - o3tl::sorted_vector<SfxPoolItem*>::const_iterator end() { return maPoolItemSet.end(); } + o3tl::sorted_vector<SfxPoolItem*>::const_iterator begin() const { return maPoolItemSet.begin(); } + o3tl::sorted_vector<SfxPoolItem*>::const_iterator end() const { return maPoolItemSet.end(); } /// clear array of PoolItem variants after all PoolItems are deleted /// or all ref counts are decreased void clear(); size_t size() const {return maPoolItemSet.size();} + bool empty() const {return maPoolItemSet.empty();} void insert(SfxPoolItem* pItem) { maPoolItemSet.insert(pItem); } - o3tl::sorted_vector<SfxPoolItem*>::const_iterator find(SfxPoolItem* pItem) { return maPoolItemSet.find(pItem); } + o3tl::sorted_vector<SfxPoolItem*>::const_iterator find(SfxPoolItem* pItem) const { return maPoolItemSet.find(pItem); } void erase(o3tl::sorted_vector<SfxPoolItem*>::const_iterator it) { return maPoolItemSet.erase(it); } }; struct SfxItemPool_Impl { SfxBroadcaster aBC; - std::vector<std::unique_ptr<SfxPoolItemArray_Impl>> maPoolItems; + std::vector<SfxPoolItemArray_Impl> maPoolItemArrays; std::vector<SfxItemPoolUser*> maSfxItemPoolUsers; /// ObjectUser section OUString aName; std::vector<SfxPoolItem*> maPoolDefaults; @@ -70,7 +71,7 @@ struct SfxItemPool_Impl MapUnit eDefMetric; SfxItemPool_Impl( SfxItemPool* pMaster, const OUString& rName, sal_uInt16 nStart, sal_uInt16 nEnd ) - : maPoolItems(nEnd - nStart + 1) + : maPoolItemArrays(nEnd - nStart + 1) , aName(rName) , maPoolDefaults(nEnd - nStart + 1) , mpStaticDefaults(nullptr) @@ -90,7 +91,7 @@ struct SfxItemPool_Impl void DeleteItems() { - maPoolItems.clear(); + maPoolItemArrays.clear(); maPoolDefaults.clear(); mpPoolRanges.reset(); } |