diff options
author | weili <weili@chromium.org> | 2016-08-04 15:43:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-04 15:43:59 -0700 |
commit | cddf8253692d3beaa97a502c8b60c1d18f81664a (patch) | |
tree | baa5b2456a1bdfec97fa97be2ef07eb3295a82d7 /xfa/fxfa | |
parent | 32e693fe13105fab5baf81b334e932fce62d89b5 (diff) | |
download | pdfium-cddf8253692d3beaa97a502c8b60c1d18f81664a.tar.xz |
Use smart pointers for class owned pointers under xfa/fde
Use smart pointer to replace raw pointer type for class
owned member variables so that memory management will
be easier.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2208423002
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 88645b7cdd..6ac5c057c0 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -96,8 +96,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { CXFA_FFDoc* pDoc = pTextProvider->GetDocNode(); IFGAS_FontMgr* pFontMgr = pDoc->GetApp()->GetFDEFontMgr(); ASSERT(pFontMgr); - m_pSelector.reset(new CFDE_CSSStyleSelector); - m_pSelector->SetFontMgr(pFontMgr); + m_pSelector.reset(new CFDE_CSSStyleSelector(pFontMgr)); FX_FLOAT fFontSize = 10; CXFA_Font font = pTextProvider->GetFontNode(); if (font) { @@ -252,8 +251,8 @@ void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, if (!pXMLContainer || !pTextProvider || m_pAllocator) { return; } - m_pAllocator.reset(IFX_MemoryAllocator::Create(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); @@ -1294,8 +1293,7 @@ FX_BOOL CXFA_TextLayout::Loader(const CFX_SizeF& szText, FX_FLOAT& fLinePos, FX_BOOL bSavePieces) { if (!m_pAllocator) { - m_pAllocator.reset( - IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 256, 0)); + m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 256, 0); } GetTextDataNode(); if (!m_pTextDataNode) |