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

Unified Diff: xfa/fxfa/parser/cxfa_simple_parser.cpp

Issue 2555373002: Use unique_ptr for CXFA_XMLParser. (Closed)
Patch Set: Alphabetize class 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/fde/xml/fde_xml_imp.cpp ('k') | xfa/fxfa/parser/cxfa_xml_parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/cxfa_simple_parser.cpp
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index 9eca652db73d18bb48404854515530b9abb4e40e..9f6fef9c1fd6afce1444a00d4be53c64137c1a24 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -6,6 +6,8 @@
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
+#include <utility>
+
#include "core/fxcrt/fx_ext.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fgas/crt/fgas_codepage.h"
@@ -293,9 +295,11 @@ int32_t CXFA_SimpleParser::StartParse(
wCodePage != FX_CODEPAGE_UTF8) {
m_pStream->SetCodePage(FX_CODEPAGE_UTF8);
}
- m_pXMLDoc.reset(new CFDE_XMLDoc);
- m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream);
- if (!m_pXMLDoc->LoadXML(m_pXMLParser))
+ m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>();
+ auto pNewParser =
+ pdfium::MakeUnique<CXFA_XMLParser>(m_pXMLDoc->GetRoot(), m_pStream);
+ m_pXMLParser = pNewParser.get();
+ if (!m_pXMLDoc->LoadXML(std::move(pNewParser)))
return XFA_PARSESTATUS_StatusErr;
m_ePacketID = ePacketID;
@@ -326,12 +330,12 @@ int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML,
IFX_Pause* pPause) {
CloseParser();
pXMLNode = nullptr;
-
- auto pStream = pdfium::MakeRetain<CXFA_WideTextRead>(wsXML);
m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>();
- CXFA_XMLParser* pParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), pStream);
+ auto pStream = pdfium::MakeRetain<CXFA_WideTextRead>(wsXML);
+ auto pParser =
+ pdfium::MakeUnique<CXFA_XMLParser>(m_pXMLDoc->GetRoot(), pStream);
pParser->m_dwCheckStatus = 0x03;
- if (!m_pXMLDoc->LoadXML(pParser))
+ if (!m_pXMLDoc->LoadXML(std::move(pParser)))
return XFA_PARSESTATUS_StatusErr;
int32_t iRet = m_pXMLDoc->DoLoad(pPause);
« no previous file with comments | « xfa/fde/xml/fde_xml_imp.cpp ('k') | xfa/fxfa/parser/cxfa_xml_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698