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

Unified Diff: xfa/fde/xml/fde_xml_imp.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.h ('k') | xfa/fxfa/parser/cxfa_simple_parser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fde/xml/fde_xml_imp.cpp
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index f333b4fcda2caa2b3c658d13884c098d57ec0294..7880804367dfcdf4641229d52f44b99576e35f31 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -7,6 +7,7 @@
#include "xfa/fde/xml/fde_xml_imp.h"
#include <algorithm>
+#include <utility>
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_safe_types.h"
@@ -957,29 +958,27 @@ void CFDE_XMLDoc::Reset(bool bInitRoot) {
}
void CFDE_XMLDoc::ReleaseParser() {
- if (m_pXMLParser) {
- m_pXMLParser->Release();
- m_pXMLParser = nullptr;
- }
+ m_pXMLParser.reset();
if (m_pSyntaxParser) {
m_pSyntaxParser->Release();
m_pSyntaxParser = nullptr;
}
}
-bool CFDE_XMLDoc::LoadXML(CFDE_XMLParser* pXMLParser) {
+bool CFDE_XMLDoc::LoadXML(std::unique_ptr<IFDE_XMLParser> pXMLParser) {
if (!pXMLParser)
return false;
Reset(true);
- m_pXMLParser = pXMLParser;
- return !!m_pXMLParser;
+ m_pXMLParser = std::move(pXMLParser);
+ return true;
}
int32_t CFDE_XMLDoc::DoLoad(IFX_Pause* pPause) {
- if (m_iStatus >= 100)
- return m_iStatus;
- return m_iStatus = m_pXMLParser->DoParser(pPause);
+ if (m_iStatus < 100)
+ m_iStatus = m_pXMLParser->DoParser(pPause);
+
+ return m_iStatus;
}
void CFDE_XMLDoc::CloseXML() {
« no previous file with comments | « xfa/fde/xml/fde_xml_imp.h ('k') | xfa/fxfa/parser/cxfa_simple_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698