diff options
author | tsepez <tsepez@chromium.org> | 2016-12-14 05:57:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-14 05:57:10 -0800 |
commit | a9caab94c1f16929e5acf2676117224617d80f53 (patch) | |
tree | d71ff9a82fae6e6080deb76375f43056127b3ee2 /xfa/fxfa/app/xfa_ffdoc.cpp | |
parent | 992ecf7c189e5cabf43e5ad862511cf63d030966 (diff) | |
download | pdfium-a9caab94c1f16929e5acf2676117224617d80f53.tar.xz |
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
Diffstat (limited to 'xfa/fxfa/app/xfa_ffdoc.cpp')
-rw-r--r-- | xfa/fxfa/app/xfa_ffdoc.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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<CXFA_FFNotify>(this); + m_pDocumentParser = pdfium::MakeUnique<CXFA_DocumentParser>(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<CXFA_FFDocView>(this); return m_TypeToDocViewMap[dwView].get(); } |