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

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

Issue 2559763002: Refcount IFGAS_ streams all the time, too (Closed)
Patch Set: more 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/parser/cxfa_simple_parser.h ('k') | xfa/fxfa/parser/cxfa_widetextread.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 2329e86874fd910d72ec921e57fd5a42078056b2..9eca652db73d18bb48404854515530b9abb4e40e 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -282,8 +283,8 @@ int32_t CXFA_SimpleParser::StartParse(
XFA_XDPPACKET ePacketID) {
CloseParser();
m_pFileRead = pStream;
- m_pStream.reset(IFGAS_Stream::CreateStream(
- pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text));
+ m_pStream = IFGAS_Stream::CreateStream(
+ pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text);
if (!m_pStream)
return XFA_PARSESTATUS_StreamErr;
@@ -293,7 +294,7 @@ int32_t CXFA_SimpleParser::StartParse(
m_pStream->SetCodePage(FX_CODEPAGE_UTF8);
}
m_pXMLDoc.reset(new CFDE_XMLDoc);
- m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream.get());
+ m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream);
if (!m_pXMLDoc->LoadXML(m_pXMLParser))
return XFA_PARSESTATUS_StatusErr;
@@ -313,10 +314,10 @@ int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) {
m_pRootNode = ParseAsXDPPacket(GetDocumentNode(m_pXMLDoc.get()), m_ePacketID);
m_pXMLDoc->CloseXML();
- m_pStream.reset();
-
+ m_pStream.Reset();
if (!m_pRootNode)
return XFA_PARSESTATUS_StatusErr;
+
return XFA_PARSESTATUS_Done;
}
@@ -326,10 +327,9 @@ int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML,
CloseParser();
pXMLNode = nullptr;
- std::unique_ptr<IFGAS_Stream> pStream(new CXFA_WideTextRead(wsXML));
- m_pXMLDoc.reset(new CFDE_XMLDoc);
- CXFA_XMLParser* pParser =
- new CXFA_XMLParser(m_pXMLDoc->GetRoot(), pStream.get());
+ auto pStream = pdfium::MakeRetain<CXFA_WideTextRead>(wsXML);
+ m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>();
+ CXFA_XMLParser* pParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), pStream);
pParser->m_dwCheckStatus = 0x03;
if (!m_pXMLDoc->LoadXML(pParser))
return XFA_PARSESTATUS_StatusErr;
@@ -1306,5 +1306,5 @@ void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode,
void CXFA_SimpleParser::CloseParser() {
m_pXMLDoc.reset();
- m_pStream.reset();
+ m_pStream.Reset();
}
« no previous file with comments | « xfa/fxfa/parser/cxfa_simple_parser.h ('k') | xfa/fxfa/parser/cxfa_widetextread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698