diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-17 11:38:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-17 22:40:40 +0200 |
commit | 4dc40659044566280c202e26cab97d682ae6ab54 (patch) | |
tree | d97f0e436aac00a5f52624959b0662eb21a534a0 /basic/source/runtime/runtime.cxx | |
parent | reduce alloc costs for some basegfx objects (tdf#105575) (diff) | |
download | core-4dc40659044566280c202e26cab97d682ae6ab54.tar.gz core-4dc40659044566280c202e26cab97d682ae6ab54.zip |
rtl::Static -> thread-safe static local
Change-Id: I9f8fe250813f4f376dc46c6f3d7e25e90fdbb50e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120566
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/runtime/runtime.cxx')
-rw-r--r-- | basic/source/runtime/runtime.cxx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index e88065225793..b100e93cac20 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1769,17 +1769,16 @@ typedef std::unordered_map< SbxVariable*, DimAsNewRecoverItem, namespace { -class GaDimAsNewRecoverHash : public rtl::Static<DimAsNewRecoverHash, GaDimAsNewRecoverHash> {}; +DimAsNewRecoverHash gaDimAsNewRecoverHash; } void removeDimAsNewRecoverItem( SbxVariable* pVar ) { - DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get(); - DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( pVar ); - if( it != rDimAsNewRecoverHash.end() ) + DimAsNewRecoverHash::iterator it = gaDimAsNewRecoverHash.find( pVar ); + if( it != gaDimAsNewRecoverHash.end() ) { - rDimAsNewRecoverHash.erase( it ); + gaDimAsNewRecoverHash.erase( it ); } } @@ -1950,9 +1949,8 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b if( xPrevVarObj.is() ) { // Object is overwritten with NULL, instantiate init object - DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get(); - DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( refVar.get() ); - if( it != rDimAsNewRecoverHash.end() ) + DimAsNewRecoverHash::iterator it = gaDimAsNewRecoverHash.find( refVar.get() ); + if( it != gaDimAsNewRecoverHash.end() ) { const DimAsNewRecoverItem& rItem = it->second; if( rItem.m_pClassModule != nullptr ) @@ -1985,16 +1983,15 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b OUString aObjClass = pValObj->GetClassName(); SbClassModuleObject* pClassModuleObj = dynamic_cast<SbClassModuleObject*>( pValObjBase ); - DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get(); if( pClassModuleObj != nullptr ) { SbModule* pClassModule = pClassModuleObj->getClassModule(); - rDimAsNewRecoverHash[refVar.get()] = + gaDimAsNewRecoverHash[refVar.get()] = DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule ); } else if( aObjClass.equalsIgnoreAsciiCase( "Collection" ) ) { - rDimAsNewRecoverHash[refVar.get()] = + gaDimAsNewRecoverHash[refVar.get()] = DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), nullptr ); } } |