diff options
author | dsinclair <dsinclair@chromium.org> | 2016-07-11 08:55:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-11 08:55:08 -0700 |
commit | bb95c50663a1ba3378c6b079dc21dc7deb8ea53a (patch) | |
tree | c604c09399411c2d002c789ff8073e11f210632f /xfa/fxfa/parser/cxfa_document_parser.cpp | |
parent | 34f86b0c7816289d2a0b402d1909572f4e95613b (diff) | |
download | pdfium-bb95c50663a1ba3378c6b079dc21dc7deb8ea53a.tar.xz |
Cleanup ownership of parser members
Change m_pXMLDoc and m_pStream in CXFA_SimpleParser to be a unique_ptr. This
allows removing the CloseParser() call from CXFA_DocumentParser as the items
will get cleaned up automatically.
Review-Url: https://codereview.chromium.org/2131653002
Diffstat (limited to 'xfa/fxfa/parser/cxfa_document_parser.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index 565916ba93..ff54fb3d87 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -13,12 +13,13 @@ CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) : m_nodeParser(nullptr, TRUE), m_pNotify(pNotify) {} CXFA_DocumentParser::~CXFA_DocumentParser() { - CloseParser(); } int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID) { - CloseParser(); + m_pDocument.reset(); + m_nodeParser.CloseParser(); + int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID); if (nRetStatus == XFA_PARSESTATUS_Ready) { m_pDocument.reset(new CXFA_Document(this)); @@ -47,8 +48,3 @@ CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const { CXFA_Document* CXFA_DocumentParser::GetDocument() const { return m_pDocument.get(); } - -void CXFA_DocumentParser::CloseParser() { - m_pDocument.reset(); - m_nodeParser.CloseParser(); -} |