From a9caab94c1f16929e5acf2676117224617d80f53 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 14 Dec 2016 05:57:10 -0800 Subject: Avoid the ptr.reset(new XXX()) anti-pattern Be suspicious of |new|. This removes some of the easy cases. Review-Url: https://codereview.chromium.org/2571913002 --- xfa/fxfa/app/xfa_ffdoc.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'xfa/fxfa/app/xfa_ffdoc.cpp') diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 516f3d7fa0..c34213c17e 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -16,6 +16,7 @@ #include "core/fpdfdoc/cpdf_nametree.h" #include "core/fxcrt/fx_ext.h" #include "core/fxcrt/fx_memory.h" +#include "third_party/base/ptr_util.h" #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fwl/cfwl_notedriver.h" #include "xfa/fxfa/app/xfa_ffnotify.h" @@ -166,10 +167,9 @@ uint32_t CXFA_FFDoc::GetDocType() { } int32_t CXFA_FFDoc::StartLoad() { - m_pNotify.reset(new CXFA_FFNotify(this)); - m_pDocumentParser.reset(new CXFA_DocumentParser(m_pNotify.get())); - int32_t iStatus = m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP); - return iStatus; + m_pNotify = pdfium::MakeUnique(this); + m_pDocumentParser = pdfium::MakeUnique(m_pNotify.get()); + return m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP); } bool XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement, @@ -272,7 +272,7 @@ void CXFA_FFDoc::StopLoad() { CXFA_FFDocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) { if (!m_TypeToDocViewMap[dwView]) - m_TypeToDocViewMap[dwView].reset(new CXFA_FFDocView(this)); + m_TypeToDocViewMap[dwView] = pdfium::MakeUnique(this); return m_TypeToDocViewMap[dwView].get(); } -- cgit v1.2.3