summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_environment.h
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-10-05 15:46:15 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-05 15:46:15 -0700
commit2116105b7d0545eb353264d4b42420cf51af5195 (patch)
tree959cb01c9d4049a9354657a7ea772b1c2860ab92 /fpdfsdk/cpdfsdk_environment.h
parente883afcab15b17769bda0a1aac0f540568df3368 (diff)
downloadpdfium-2116105b7d0545eb353264d4b42420cf51af5195.tar.xz
Remove ownership of CPDFSDK_Document from CPDFXFA_Document
This CL updates CPDFXFA_Document so it never owns the CPDFSDK_Document. The CPDFSDK_Document is now always owned by the CPDFXFA_Environment. This also cleans up the strange need to reverse the order of document and form destruction when using XFA. Review-Url: https://codereview.chromium.org/2397473006
Diffstat (limited to 'fpdfsdk/cpdfsdk_environment.h')
-rw-r--r--fpdfsdk/cpdfsdk_environment.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/fpdfsdk/cpdfsdk_environment.h b/fpdfsdk/cpdfsdk_environment.h
index 9943d38c67..bed757c2ba 100644
--- a/fpdfsdk/cpdfsdk_environment.h
+++ b/fpdfsdk/cpdfsdk_environment.h
@@ -146,8 +146,7 @@ class CPDFSDK_Environment final {
void JS_docgotoPage(int nPageNum);
FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; }
- void SetSDKDocument(CPDFSDK_Document* pFXDoc) { m_pSDKDoc = pFXDoc; }
- CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc; }
+ CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc.get(); }
UnderlyingDocumentType* GetUnderlyingDocument() const {
return m_pUnderlyingDoc;
}
@@ -166,10 +165,7 @@ class CPDFSDK_Environment final {
std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler;
std::unique_ptr<IJS_Runtime> m_pJSRuntime;
FPDF_FORMFILLINFO* const m_pInfo;
- // Ownership of |m_pSDKDoc| depends on if this is XFA. If we're in XFA then
- // the object is owned by the CPDFXFA_Document. In non-xfa then we own
- // the pointer.
- CPDFSDK_Document* m_pSDKDoc;
+ std::unique_ptr<CPDFSDK_Document> m_pSDKDoc;
UnderlyingDocumentType* const m_pUnderlyingDoc;
std::unique_ptr<CFFL_InteractiveFormFiller> m_pFormFiller;
std::unique_ptr<CFX_SystemHandler> m_pSysHandler;