From cddf8253692d3beaa97a502c8b60c1d18f81664a Mon Sep 17 00:00:00 2001 From: weili Date: Thu, 4 Aug 2016 15:43:59 -0700 Subject: 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 --- xfa/fxfa/app/xfa_textlayout.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'xfa/fxfa/app') 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) -- cgit v1.2.3