diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-05 14:29:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-10 12:31:43 +0200 |
commit | 0fb5ca6cc9cc55a4436a36c533461769b1fc8526 (patch) | |
tree | 30e21bfcb0a6ad46f52a4e664728753c03d7a837 /writerfilter/source/rtftok/rtfdispatchsymbol.cxx | |
parent | 1a33947a91685808fd5f6d4903b6ae896686066d (diff) |
tdf#79877 perf loading docx file, writerfilter/ improvements
this improves load time by 20%.
We switch from shared_ptr to tools::SvRef to manage the objects
I noticed some double inheritance like this:
DomainMapper
LoggedProperties
Properties
SvRefBase
LoggedTable
Table
SvRefBase
so to be safe I made all the ref-count-base-class inheritance
virtual.
Change-Id: Ia3de9733f5c6966e8171f43d083dcc087040b8cd
Reviewed-on: https://gerrit.libreoffice.org/57022
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerfilter/source/rtftok/rtfdispatchsymbol.cxx')
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index e5ae836bb206..5478f5ec0f1a 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -112,9 +112,9 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) // Was in table, but not anymore -> tblEnd. RTFSprms aAttributes; RTFSprms aSprms; - aSprms.set(NS_ooxml::LN_tblEnd, std::make_shared<RTFValue>(1)); + aSprms.set(NS_ooxml::LN_tblEnd, new RTFValue(1)); writerfilter::Reference<Properties>::Pointer_t pProperties - = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); + = new RTFReferenceProperties(aAttributes, aSprms); Mapper().props(pProperties); } m_nCellxMax = 0; @@ -180,11 +180,11 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) if (m_bNeedPap) { // There were no runs in the cell, so we need to send paragraph and character properties here. - auto pPValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, - m_aStates.top().aParagraphSprms); + auto pPValue = new RTFValue(m_aStates.top().aParagraphAttributes, + m_aStates.top().aParagraphSprms); m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pPValue, nullptr)); - auto pCValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, - m_aStates.top().aCharacterSprms); + auto pCValue = new RTFValue(m_aStates.top().aCharacterAttributes, + m_aStates.top().aCharacterSprms); m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pCValue, nullptr)); } @@ -195,7 +195,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) break; case RTF_NESTROW: { - std::shared_ptr<TableRowBuffer> const pBuffer( + tools::SvRef<TableRowBuffer> const pBuffer( new TableRowBuffer(m_aTableBufferStack.back(), m_aNestedTableCellsSprms, m_aNestedTableCellsAttributes, m_nNestedCells)); prepareProperties(m_aStates.top(), pBuffer->pParaProperties, pBuffer->pFrameProperties, @@ -234,7 +234,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) { // Add fake cellx / cell, RTF equivalent of // OOXMLFastContextHandlerTextTableRow::handleGridAfter(). - auto pXValue = std::make_shared<RTFValue>(m_aStates.top().nTableRowWidthAfter); + auto pXValue = new RTFValue(m_aStates.top().nTableRowWidthAfter); m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND); dispatchSymbol(RTF_CELL); @@ -261,8 +261,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) auto pXValueLast = m_aStates.top().aTableRowSprms.find( NS_ooxml::LN_CT_TblGridBase_gridCol, false); const int nXValueLast = pXValueLast ? pXValueLast->getInt() : 0; - auto pXValue = std::make_shared<RTFValue>(nXValueLast + m_nCellxMax - - m_nTopLevelCurrentCellX); + auto pXValue = new RTFValue(nXValueLast + m_nCellxMax - m_nTopLevelCurrentCellX); m_aStates.top().aTableRowSprms.eraseLast(NS_ooxml::LN_CT_TblGridBase_gridCol); m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND); |