From 8509d3eaec1b2fac27a24de7bc586ad12b7bb178 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 4 Dec 2017 06:13:55 +0000 Subject: Make a CXFA_DocumentParser member Unowned. Fix/cleanup ctors/dtors in related classes. Change-Id: Ia05ec9b6892fd7d19d0a417fc1226a407e3ac260 Reviewed-on: https://pdfium-review.googlesource.com/20216 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- xfa/fxfa/cxfa_ffdoc.cpp | 8 ++------ xfa/fxfa/cxfa_ffdoc.h | 4 ++-- xfa/fxfa/parser/cxfa_document_parser.cpp | 2 +- xfa/fxfa/parser/cxfa_document_parser.h | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index bf8168d4cc..8ca1e95d87 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -155,12 +155,7 @@ int32_t Base64DecodeW(const wchar_t* pSrc, int32_t iSrcLen, uint8_t* pDst) { } // namespace CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment) - : m_pDocEnvironment(pDocEnvironment), - m_pDocumentParser(nullptr), - m_pApp(pApp), - m_pNotify(nullptr), - m_pPDFDoc(nullptr), - m_FormType(FormType::kXFAForeground) {} + : m_pDocEnvironment(pDocEnvironment), m_pApp(pApp) {} CXFA_FFDoc::~CXFA_FFDoc() { CloseDoc(); @@ -328,6 +323,7 @@ void CXFA_FFDoc::CloseDoc() { if (doc) doc->ClearLayoutData(); + m_pDocumentParser.reset(); m_pNotify.reset(); m_pPDFFontMgr.reset(); m_HashToDibDpiMap.clear(); diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h index 10ffa36275..475ead3035 100644 --- a/xfa/fxfa/cxfa_ffdoc.h +++ b/xfa/fxfa/cxfa_ffdoc.h @@ -85,13 +85,13 @@ class CXFA_FFDoc { UnownedPtr const m_pDocEnvironment; std::unique_ptr m_pDocumentParser; RetainPtr m_pStream; - UnownedPtr m_pApp; + UnownedPtr const m_pApp; std::unique_ptr m_pNotify; UnownedPtr m_pPDFDoc; std::map m_HashToDibDpiMap; std::unique_ptr m_DocView; std::unique_ptr m_pPDFFontMgr; - FormType m_FormType; + FormType m_FormType = FormType::kXFAForeground; }; #endif // XFA_FXFA_CXFA_FFDOC_H_ diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index df7d789781..6446ea31ce 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -45,7 +45,7 @@ CFX_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const { } CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const { - return m_pNotify; + return m_pNotify.Get(); } CXFA_Document* CXFA_DocumentParser::GetDocument() const { diff --git a/xfa/fxfa/parser/cxfa_document_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h index 6629101457..35d71603cb 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.h +++ b/xfa/fxfa/parser/cxfa_document_parser.h @@ -31,7 +31,7 @@ class CXFA_DocumentParser { CXFA_Document* GetDocument() const; private: - CXFA_FFNotify* const m_pNotify; + UnownedPtr const m_pNotify; std::unique_ptr m_pDocument; CXFA_SimpleParser m_nodeParser; }; -- cgit v1.2.3