From b685e6471075bebd26711bc183de3128f54932e3 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 13 Oct 2016 10:57:01 -0700 Subject: Revert of Make the CPDFXFA_App non-global (patchset #3 id:80001 of https://codereview.chromium.org/2416753002/ ) Reason for revert: https://build.chromium.org/p/client.pdfium/builders/linux_xfa_asan_lsan/builds/112/steps/embeddertests/logs/stdio msan is sad. Original issue's description: > Make the CPDFXFA_App non-global > > This CL changes CPDFXFA_App from a global object to a child of the > CPDFXFA_Document objects. > > BUG=pdfium:623 > > Committed: https://pdfium.googlesource.com/pdfium/+/abefb79577b32d291d14d7e01a70f6f8cf213bd3 TBR=tsepez@chromium.org,thestig@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=pdfium:623 Review-Url: https://codereview.chromium.org/2412903004 --- fpdfsdk/fpdfxfa/cpdfxfa_document.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_document.h') diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.h b/fpdfsdk/fpdfxfa/cpdfxfa_document.h index 88c0e60f2d..de997c16f3 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_document.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_document.h @@ -9,11 +9,11 @@ #include -#include "fpdfsdk/fpdfxfa/cpdfxfa_app.h" #include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" #include "xfa/fxfa/xfa_ffdoc.h" class CPDFSDK_FormFillEnvironment; +class CPDFXFA_App; class CPDFXFA_Page; class CXFA_FFDocHandler; class IJS_Runtime; @@ -29,7 +29,8 @@ enum LoadStatus { class CPDFXFA_Document { public: - CPDFXFA_Document(std::unique_ptr pPDFDoc); + CPDFXFA_Document(std::unique_ptr pPDFDoc, + CPDFXFA_App* pProvider); ~CPDFXFA_Document(); FX_BOOL LoadXFADoc(); @@ -37,11 +38,9 @@ class CPDFXFA_Document { CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } int GetDocType() const { return m_iDocType; } - CPDFXFA_App* GetApp(); // Creates if needed. CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv; } void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv) { - GetApp()->SetFormFillEnv(pFormFillEnv); m_pFormFillEnv = pFormFillEnv; } @@ -69,7 +68,13 @@ class CPDFXFA_Document { CFX_ArrayTemplate* GetXFAPageList() { return &m_XFAPageList; } private: - void CloseXFADoc(CXFA_FFDocHandler* pDoc); + void CloseXFADoc(CXFA_FFDocHandler* pDoc) { + if (pDoc) { + m_pXFADoc->CloseDoc(); + m_pXFADoc.reset(); + m_pXFADocView = nullptr; + } + } int m_iDocType; @@ -77,7 +82,7 @@ class CPDFXFA_Document { std::unique_ptr m_pXFADoc; CPDFSDK_FormFillEnvironment* m_pFormFillEnv; // not owned. CXFA_FFDocView* m_pXFADocView; // not owned. - std::unique_ptr m_pApp; + CPDFXFA_App* const m_pApp; CFX_ArrayTemplate m_XFAPageList; LoadStatus m_nLoadStatus; int m_nPageCount; -- cgit v1.2.3