summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-31 23:38:32 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-31 23:38:32 +0000
commit2d11d72e326140b9abeb6de2db1e28e5bf9d7e64 (patch)
treeffd41a61a342924bded55443d6a478b3f8caee0f /fpdfsdk/fpdfxfa
parent73659ee409ae4840c5019633a5c4000eececd7c0 (diff)
downloadpdfium-2d11d72e326140b9abeb6de2db1e28e5bf9d7e64.tar.xz
Make CPDF_Document own its Extension.
Inverting the ownership from the current situation makes cleanup much more intuitive. Change-Id: Iad9a7ca70c0746170ba753297732e3e34f96c5ba Reviewed-on: https://pdfium-review.googlesource.com/33190 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.cpp11
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.h4
2 files changed, 7 insertions, 8 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 3b10f0d51e..36d86650b7 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -36,11 +36,10 @@ extern void SetLastError(int err);
extern int GetLastError();
#endif
-CPDFXFA_Context::CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc)
- : m_pPDFDoc(std::move(pPDFDoc)),
+CPDFXFA_Context::CPDFXFA_Context(CPDF_Document* pPDFDoc)
+ : m_pPDFDoc(pPDFDoc),
m_pXFAApp(pdfium::MakeUnique<CXFA_FFApp>(this)),
- m_DocEnv(this) {
-}
+ m_DocEnv(this) {}
CPDFXFA_Context::~CPDFXFA_Context() {
m_nLoadStatus = FXFA_LOADSTATUS_CLOSING;
@@ -99,7 +98,7 @@ bool CPDFXFA_Context::LoadXFADoc() {
return false;
m_pXFADoc = pdfium::MakeUnique<CXFA_FFDoc>(pApp, &m_DocEnv);
- if (!m_pXFADoc->OpenDoc(m_pPDFDoc.get())) {
+ if (!m_pXFADoc->OpenDoc(m_pPDFDoc.Get())) {
SetLastError(FPDF_ERR_XFALOAD);
return false;
}
@@ -189,7 +188,7 @@ RetainPtr<CPDFXFA_Page> CPDFXFA_Context::GetXFAPage(
}
CPDF_Document* CPDFXFA_Context::GetPDFDoc() const {
- return m_pPDFDoc.get();
+ return m_pPDFDoc.Get();
}
void CPDFXFA_Context::DeletePage(int page_index) {
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index a01990cce4..b240e7ee11 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -36,7 +36,7 @@ enum LoadStatus {
class CPDFXFA_Context : public CPDF_Document::Extension,
public IXFA_AppProvider {
public:
- explicit CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc);
+ explicit CPDFXFA_Context(CPDF_Document* pPDFDoc);
~CPDFXFA_Context() override;
bool LoadXFADoc();
@@ -112,7 +112,7 @@ class CPDFXFA_Context : public CPDF_Document::Extension,
void CloseXFADoc();
FormType m_FormType = FormType::kNone;
- std::unique_ptr<CPDF_Document> m_pPDFDoc;
+ UnownedPtr<CPDF_Document> m_pPDFDoc;
std::unique_ptr<CXFA_FFDoc> m_pXFADoc;
Observable<CPDFSDK_FormFillEnvironment>::ObservedPtr m_pFormFillEnv;
UnownedPtr<CXFA_FFDocView> m_pXFADocView;