diff options
author | tsepez <tsepez@chromium.org> | 2016-05-03 14:13:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-03 14:13:29 -0700 |
commit | 4d06f83da7fbc65e83ecc3c36b339c04ac1ab668 (patch) | |
tree | 183592694f9c93951838111130d78d204e1e9a68 /xfa/fxfa/app | |
parent | 89fcde88f0c03da77d7fd83dece7726d66fd190e (diff) | |
download | pdfium-4d06f83da7fbc65e83ecc3c36b339c04ac1ab668.tar.xz |
Cleanup XFA-Specific memory allocators.
Remove unused "dynamic" allocator (the scary one).
Use malloc/free wrapper allocator under #ifdef for CF/asan testing.
Rename IFX_MEMAllocator to IFX_MemoryAllocator (MEM in all caps
would imply that MEM was an acroynm, not an abbreviation).
Review-Url: https://codereview.chromium.org/1944093002
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.h | 15 |
2 files changed, 13 insertions, 12 deletions
diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 9ed84e1604..bd06421870 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -212,8 +212,8 @@ void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, if (pXMLContainer == NULL || pTextProvider == NULL || m_pAllocator) { return; } - m_pAllocator = - FX_CreateAllocator(FX_ALLOCTYPE_Fixed, 32, sizeof(CXFA_CSSTagProvider)); + m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, 32, + sizeof(CXFA_CSSTagProvider)); InitCSSData(pTextProvider); IFDE_CSSComputedStyle* pRootStyle = CreateRootStyle(pTextProvider); ParseRichText(pXMLContainer, pRootStyle); @@ -1272,9 +1272,9 @@ void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { FX_BOOL CXFA_TextLayout::Loader(const CFX_SizeF& szText, FX_FLOAT& fLinePos, FX_BOOL bSavePieces) { - if (m_pAllocator == NULL) { - m_pAllocator = FX_CreateAllocator(FX_ALLOCTYPE_Static, 256, 0); - } + if (!m_pAllocator) + m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 256, 0); + GetTextDataNode(); if (m_pTextDataNode == NULL) { return TRUE; diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index bc6719a4df..17450ddeab 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -130,7 +130,7 @@ class CXFA_TextParser { void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); - IFX_MEMAllocator* m_pAllocator; + IFX_MemoryAllocator* m_pAllocator; CFDE_CSSStyleSelector* m_pSelector; IFDE_CSSStyleSheet* m_pUASheet; CFX_MapPtrTemplate<CFDE_XMLNode*, CXFA_TextParseContext*> @@ -169,7 +169,7 @@ class CXFA_LoaderContext { class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { public: - CXFA_LinkUserData(IFX_MEMAllocator* pAllocator, FX_WCHAR* pszText) + CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, FX_WCHAR* pszText) : m_pAllocator(pAllocator), m_dwRefCount(1) { m_pszURLContent = pszText; } @@ -186,14 +186,15 @@ class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { const FX_WCHAR* GetLinkURL() { return m_pszURLContent.c_str(); } protected: - IFX_MEMAllocator* m_pAllocator; + IFX_MemoryAllocator* m_pAllocator; uint32_t m_dwRefCount; CFX_WideString m_pszURLContent; }; class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { public: - CXFA_TextUserData(IFX_MEMAllocator* pAllocator, IFDE_CSSComputedStyle* pStyle) + CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, + IFDE_CSSComputedStyle* pStyle) : m_pStyle(pStyle), m_pLinkData(nullptr), m_pAllocator(pAllocator), @@ -202,7 +203,7 @@ class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { if (m_pStyle) m_pStyle->AddRef(); } - CXFA_TextUserData(IFX_MEMAllocator* pAllocator, + CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, IFDE_CSSComputedStyle* pStyle, CXFA_LinkUserData* pLinkData) : m_pStyle(pStyle), @@ -232,7 +233,7 @@ class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { CXFA_LinkUserData* m_pLinkData; protected: - IFX_MEMAllocator* m_pAllocator; + IFX_MemoryAllocator* m_pAllocator; uint32_t m_dwRefCount; }; @@ -404,7 +405,7 @@ class CXFA_TextLayout { CXFA_TextProvider* m_pTextProvider; CXFA_Node* m_pTextDataNode; FX_BOOL m_bRichText; - IFX_MEMAllocator* m_pAllocator; + IFX_MemoryAllocator* m_pAllocator; CFX_RTFBreak* m_pBreak; CXFA_LoaderContext* m_pLoader; int32_t m_iLines; |