summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-07 22:06:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-08 17:36:54 +0200
commit1545949690c750d7b512000723b564e69cf3c3a6 (patch)
tree1463c8b2912a9e269fe8b7ef3f7326dc85173830 /chart2/source
parentc10ce2698a3b001d22db3d33f2f43513cc49ebda (diff)
ref-count SfxItemPool
so we can remove SfxItemPoolUser, which is a right performance hog when we have large calc spreadsheets Change-Id: I344002f536f6eead5cf98c6647dd1667fd9c8874 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115247 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx19
-rw-r--r--chart2/source/view/main/ChartItemPool.hxx2
2 files changed, 6 insertions, 15 deletions
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index 2b3e59dc3c31..8c2bf391953c 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -204,7 +204,7 @@ ChartItemPool::~ChartItemPool()
ReleaseDefaults(true);
}
-SfxItemPool* ChartItemPool::Clone() const
+rtl::Reference<SfxItemPool> ChartItemPool::Clone() const
{
return new ChartItemPool(*this);
}
@@ -214,25 +214,16 @@ MapUnit ChartItemPool::GetMetric(sal_uInt16 /* nWhich */) const
return MapUnit::Map100thMM;
}
-namespace {
-struct PoolDeleter
-{
- void operator()(SfxItemPool* pPool)
- {
- SfxItemPool::Free(pPool);
- }
-};
-}
-static std::unique_ptr<SfxItemPool, PoolDeleter> g_Pool1, g_Pool2, g_Pool3;
+static rtl::Reference<SfxItemPool> g_Pool1, g_Pool2, g_Pool3;
SfxItemPool& ChartItemPool::GetGlobalChartItemPool()
{
if (!g_Pool1)
{
// similar logic to SdrModel's pool, but with our chart pool tagged on the end
- g_Pool1.reset(new SdrItemPool(nullptr));
- g_Pool2.reset(EditEngine::CreatePool());
- g_Pool3.reset(new ChartItemPool());
+ g_Pool1 = new SdrItemPool(nullptr);
+ g_Pool2 = EditEngine::CreatePool();
+ g_Pool3 = new ChartItemPool();
g_Pool1->SetSecondaryPool(g_Pool2.get());
g_Pool1->SetDefaultMetric(MapUnit::Map100thMM);
diff --git a/chart2/source/view/main/ChartItemPool.hxx b/chart2/source/view/main/ChartItemPool.hxx
index 43f461a6aade..2ac440183740 100644
--- a/chart2/source/view/main/ChartItemPool.hxx
+++ b/chart2/source/view/main/ChartItemPool.hxx
@@ -36,7 +36,7 @@ protected:
virtual ~ChartItemPool() override;
public:
- virtual SfxItemPool* Clone() const override;
+ virtual rtl::Reference<SfxItemPool> Clone() const override;
MapUnit GetMetric(sal_uInt16 nWhich) const override;
/// get the pure chart item pool