diff options
author | dsinclair <dsinclair@chromium.org> | 2016-08-24 11:12:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-24 11:12:19 -0700 |
commit | cedaa557316a3f5c436814e69d67f19795f471d7 (patch) | |
tree | 128140994288bcd5b01f578e9dafc4bf1ea87493 /fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h | |
parent | ade4b495433751ac853f2d677b9e1da94d0d6bf7 (diff) | |
download | pdfium-cedaa557316a3f5c436814e69d67f19795f471d7.tar.xz |
Flip document and parser ownership
This Cl switches the ownership between the parser and the document. Previously
the parser owned the document and we'd jump through hoops during cleanup to
delete the right object. This Cl flips the ownership so the document owns
the parser and simplifies the cleanup logic where needed.
BUG=pdfium:565
Review-Url: https://codereview.chromium.org/2275773003
Diffstat (limited to 'fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h')
-rw-r--r-- | fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h index ed4c8727fc..c83c770f97 100644 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h +++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h @@ -27,12 +27,13 @@ class CXFA_FFDocHandler; class CPDFXFA_Document : public IXFA_DocProvider { public: - CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider); + CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc, + CPDFXFA_App* pProvider); ~CPDFXFA_Document() override; FX_BOOL LoadXFADoc(); CPDFXFA_App* GetApp() { return m_pApp; } - CPDF_Document* GetPDFDoc() { return m_pPDFDoc; } + CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); } CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } @@ -200,7 +201,10 @@ class CPDFXFA_Document : public IXFA_DocProvider { } int m_iDocType; - CPDF_Document* m_pPDFDoc; + + // |m_pSDKDoc| has to be released before |m_pPDFDoc| since it needs to access + // it to kill focused annotations. + std::unique_ptr<CPDF_Document> m_pPDFDoc; std::unique_ptr<CPDFSDK_Document> m_pSDKDoc; std::unique_ptr<CXFA_FFDoc> m_pXFADoc; CXFA_FFDocView* m_pXFADocView; // not owned. |