From 56b08b1f2bb8a4eb9330963bff3a626603499730 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 4 Dec 2017 06:04:35 +0000 Subject: Make CXFA_SimpleParser members const or Unowned. Fix ownership issues, and simplify CXFA_SimpleParser ctors. Change-Id: Ie083080297c5c2586ae3e6a8355839fcb86ee9ea Reviewed-on: https://pdfium-review.googlesource.com/20130 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- xfa/fxfa/parser/cxfa_simple_parser.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_simple_parser.h') diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h index 2ccb2c3b1a..52bb60fac5 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.h +++ b/xfa/fxfa/parser/cxfa_simple_parser.h @@ -22,7 +22,8 @@ class CFX_SeekableStreamProxy; class CXFA_SimpleParser { public: - CXFA_SimpleParser(CXFA_Document* pFactory, bool bDocumentParser); + CXFA_SimpleParser(); + explicit CXFA_SimpleParser(CXFA_Document* pFactory); ~CXFA_SimpleParser(); int32_t StartParse(const RetainPtr& pStream, @@ -34,6 +35,7 @@ class CXFA_SimpleParser { CFX_XMLDoc* GetXMLDoc() const; void CloseParser(); + // Called later for the ctor with no parameters. void SetFactory(CXFA_Document* pFactory); private: @@ -71,15 +73,16 @@ class CXFA_SimpleParser { CFX_XMLInstruction* pXMLInstruction, XFA_PacketType ePacketID); - CFX_XMLParser* m_pXMLParser; + UnownedPtr m_pXMLParser; // Owned by |m_pXMLDoc| std::unique_ptr m_pXMLDoc; RetainPtr m_pStream; RetainPtr m_pFileRead; - CXFA_Document* m_pFactory; - CXFA_Node* m_pRootNode; - XFA_PacketType m_ePacketID; - bool m_bParseStarted; - bool m_bDocumentParser; + UnownedPtr m_pFactory; + // TODO(dsinclair): Figure out who owns this. + CXFA_Node* m_pRootNode = nullptr; + XFA_PacketType m_ePacketID = XFA_PacketType::User; + bool m_bParseStarted = false; + const bool m_bDocumentParser; }; #endif // XFA_FXFA_PARSER_CXFA_SIMPLE_PARSER_H_ -- cgit v1.2.3