diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-10 16:38:10 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-10 21:53:32 +0000 |
commit | 0cb9b8cb094532ff868314350680d3fb0ca2fe51 (patch) | |
tree | 60e61f1e9547d5b99c010ee96b8c0ea7c0480e85 /xfa/fxfa/app/cxfa_textparser.cpp | |
parent | 1f5d4988dcdac125e3e822d37c9086a5e4a3e224 (diff) | |
download | pdfium-0cb9b8cb094532ff868314350680d3fb0ca2fe51.tar.xz |
Strip out custom allocator code
This Cl replaces the custom IFX_MemoryAllocator code with new/delete as needed.
Change-Id: Ie786f607c9e0b3035ffd87733bc3e29a4b6426d9
Reviewed-on: https://pdfium-review.googlesource.com/2164
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/app/cxfa_textparser.cpp')
-rw-r--r-- | xfa/fxfa/app/cxfa_textparser.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp index b865e5e576..50f6cbaea2 100644 --- a/xfa/fxfa/app/cxfa_textparser.cpp +++ b/xfa/fxfa/app/cxfa_textparser.cpp @@ -36,29 +36,25 @@ enum class TabStopStatus { } // namespace -CXFA_TextParser::CXFA_TextParser() : m_pUASheet(nullptr) {} +CXFA_TextParser::CXFA_TextParser() : m_pUASheet(nullptr), m_bParsed(false) {} CXFA_TextParser::~CXFA_TextParser() { if (m_pUASheet) m_pUASheet->Release(); for (auto& pair : m_mapXMLNodeToParseContext) { - if (pair.second) { - FXTARGET_DeleteWith(CXFA_TextParseContext, m_pAllocator.get(), - pair.second); - } + if (pair.second) + delete pair.second; } } void CXFA_TextParser::Reset() { for (auto& pair : m_mapXMLNodeToParseContext) { - if (pair.second) { - FXTARGET_DeleteWith(CXFA_TextParseContext, m_pAllocator.get(), - pair.second); - } + if (pair.second) + delete pair.second; } m_mapXMLNodeToParseContext.clear(); - m_pAllocator.reset(); + m_bParsed = false; } void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { if (!pTextProvider) @@ -220,11 +216,10 @@ IFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle( void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider) { - if (!pXMLContainer || !pTextProvider || m_pAllocator) + if (!pXMLContainer || !pTextProvider || m_bParsed) return; - m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, 32, - sizeof(CXFA_CSSTagProvider)); + m_bParsed = true; InitCSSData(pTextProvider); IFDE_CSSComputedStyle* pRootStyle = CreateRootStyle(pTextProvider); ParseRichText(pXMLContainer, pRootStyle); @@ -244,8 +239,7 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode, IFDE_CSSComputedStyle* pNewStyle = nullptr; if ((tagProvider.GetTagName() != FX_WSTRC(L"body")) || (tagProvider.GetTagName() != FX_WSTRC(L"html"))) { - CXFA_TextParseContext* pTextContext = - FXTARGET_NewWith(m_pAllocator.get()) CXFA_TextParseContext; + CXFA_TextParseContext* pTextContext = new CXFA_TextParseContext; FDE_CSSDISPLAY eDisplay = FDE_CSSDISPLAY_Inline; if (!tagProvider.m_bContent) { pNewStyle = CreateStyle(pParentStyle); |