Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: xfa/fxfa/app/xfa_ffdoc.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/app/xfa_ffapp.cpp ('k') | xfa/fxfa/app/xfa_ffdocview.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_ffdoc.cpp
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index 516f3d7fa0ca8b9d7a4eee3df24d61f916f72b5d..c34213c17efbfb577f622e8b4094b83a9bc6911a 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();
}
« no previous file with comments | « xfa/fxfa/app/xfa_ffapp.cpp ('k') | xfa/fxfa/app/xfa_ffdocview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698