diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-07 22:06:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-08 17:36:54 +0200 |
commit | 1545949690c750d7b512000723b564e69cf3c3a6 (patch) | |
tree | 1463c8b2912a9e269fe8b7ef3f7326dc85173830 /sc/source/core | |
parent | c10ce2698a3b001d22db3d33f2f43513cc49ebda (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 'sc/source/core')
-rw-r--r-- | sc/source/core/data/attrib.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/docpool.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/poolhelp.cxx | 16 | ||||
-rw-r--r-- | sc/source/core/data/stlpool.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/inc/poolhelp.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/editutil.cxx | 4 |
6 files changed, 16 insertions, 16 deletions
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index 0466ac44f7d9..fc83491845bb 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -431,7 +431,7 @@ bool ScPageHFItem::PutValue( const uno::Any& rVal, sal_uInt8 /* nMemberId */ ) if ( !pLeftArea || !pCenterArea || !pRightArea ) { // no Text with Null are left - ScEditEngineDefaulter aEngine( EditEngine::CreatePool(), true ); + ScEditEngineDefaulter aEngine( EditEngine::CreatePool().get(), true ); if (!pLeftArea) pLeftArea = aEngine.CreateTextObject(); if (!pCenterArea) diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 0a96c3b4ee5d..628c3686e2d0 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -376,7 +376,7 @@ void ScDocumentPool::CellStyleCreated( std::u16string_view rName, const ScDocume } } -SfxItemPool* ScDocumentPool::Clone() const +rtl::Reference<SfxItemPool> ScDocumentPool::Clone() const { return new SfxItemPool (*this, true); } diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx index 2091bf167d9c..bd27a96c46cb 100644 --- a/sc/source/core/data/poolhelp.cxx +++ b/sc/source/core/data/poolhelp.cxx @@ -37,27 +37,29 @@ ScPoolHelper::ScPoolHelper( ScDocument& rSourceDoc ) ScPoolHelper::~ScPoolHelper() { - pEnginePool.reset(); - pEditPool.reset(); + pEnginePool.clear(); + pEditPool.clear(); pFormTable.reset(); mxStylePool.clear(); - pDocPool.reset(); + pDocPool.clear(); } -SfxItemPool* ScPoolHelper::GetEditPool() const + +SfxItemPool* ScPoolHelper::GetEditPool() const { if ( !pEditPool ) { - pEditPool.reset(EditEngine::CreatePool()); + pEditPool = EditEngine::CreatePool(); pEditPool->SetDefaultMetric( MapUnit::Map100thMM ); pEditPool->FreezeIdRanges(); } return pEditPool.get(); } -SfxItemPool* ScPoolHelper::GetEnginePool() const + +SfxItemPool* ScPoolHelper::GetEnginePool() const { if ( !pEnginePool ) { - pEnginePool.reset(EditEngine::CreatePool()); + pEnginePool = EditEngine::CreatePool(); pEnginePool->SetDefaultMetric( MapUnit::Map100thMM ); pEnginePool->FreezeIdRanges(); } // ifg ( pEnginePool ) diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index b4074c1773b5..8248218b14c3 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -218,7 +218,7 @@ void ScStyleSheetPool::CreateStandardStyles() SfxItemSet* pSet = nullptr; SfxItemSet* pHFSet = nullptr; SvxSetItem* pHFSetItem = nullptr; - std::unique_ptr<ScEditEngineDefaulter> pEdEngine(new ScEditEngineDefaulter( EditEngine::CreatePool(), true )); + std::unique_ptr<ScEditEngineDefaulter> pEdEngine(new ScEditEngineDefaulter( EditEngine::CreatePool().get(), true )); pEdEngine->SetUpdateMode( false ); std::unique_ptr<EditTextObject> pEmptyTxtObj = pEdEngine->CreateTextObject(); std::unique_ptr<EditTextObject> pTxtObj; diff --git a/sc/source/core/inc/poolhelp.hxx b/sc/source/core/inc/poolhelp.hxx index 267d60ea8eeb..ad725fcf82d8 100644 --- a/sc/source/core/inc/poolhelp.hxx +++ b/sc/source/core/inc/poolhelp.hxx @@ -36,11 +36,11 @@ class ScPoolHelper final : public salhelper::SimpleReferenceObject private: mutable osl::Mutex maMtxCreateNumFormatter; ScDocOptions aOpt; - std::unique_ptr<ScDocumentPool, SfxItemPoolDeleter> pDocPool; + rtl::Reference<ScDocumentPool> pDocPool; rtl::Reference< ScStyleSheetPool > mxStylePool; mutable std::unique_ptr<SvNumberFormatter> pFormTable; - mutable std::unique_ptr<SfxItemPool, SfxItemPoolDeleter> pEditPool; // EditTextObjectPool - mutable std::unique_ptr<SfxItemPool, SfxItemPoolDeleter> pEnginePool; // EditEnginePool + mutable rtl::Reference<SfxItemPool> pEditPool; // EditTextObjectPool + mutable rtl::Reference<SfxItemPool> pEnginePool; // EditEnginePool ScDocument& m_rSourceDoc; public: diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index c567e36b7b55..b47c2bd7ee39 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -510,8 +510,6 @@ ScEnginePoolHelper::~ScEnginePoolHelper() { if ( bDeleteDefaults ) delete pDefaults; - if ( bDeleteEnginePool ) - SfxItemPool::Free(pEnginePool); } ScEditEngineDefaulter::ScEditEngineDefaulter( SfxItemPool* pEnginePoolP, @@ -529,7 +527,7 @@ ScEditEngineDefaulter::ScEditEngineDefaulter( SfxItemPool* pEnginePoolP, ScEditEngineDefaulter::ScEditEngineDefaulter( const ScEditEngineDefaulter& rOrg ) : ScEnginePoolHelper( rOrg ), - EditEngine( pEnginePool ) + EditEngine( pEnginePool.get() ) { SetDefaultLanguage( ScGlobal::GetEditDefaultLanguage() ); } |