summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa/cpdfxfa_context.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-27 19:32:59 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-27 19:32:59 +0000
commit862cbe46b7d7040e35733f5ed63839ee34223387 (patch)
tree45895d00a62941d48311734c5244d0d1ecf34d56 /fpdfsdk/fpdfxfa/cpdfxfa_context.h
parent2b053ce82e921984ee191b26fe9a760ba1508a66 (diff)
downloadpdfium-862cbe46b7d7040e35733f5ed63839ee34223387.tar.xz
Avoid potential duplicate unique_ptr to CPDF_Document from CPDFXA_Context.
Should FPDFDocumentFromCPDFDocument() be called several times under XFA, we may WrapUnique() the document several times. So cache a pointer back from CPDF_Document to CPDFXFA_Context to avoid this. Because of layering, introduce a placeholder type CPDF_Document::Extension. This is actually the first step in some larger XFA ownership cleanup, but makes a nice standalone CL around the one particular issue. Change-Id: I4be326ddb1a5fae7339e6ed6745dd551b1374b53 Reviewed-on: https://pdfium-review.googlesource.com/31570 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_context.h')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index 188f1fbe2f..cb42de0576 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/observable.h"
#include "core/fxcrt/unowned_ptr.h"
@@ -32,7 +33,8 @@ enum LoadStatus {
FXFA_LOADSTATUS_CLOSED
};
-class CPDFXFA_Context : public IXFA_AppProvider {
+class CPDFXFA_Context : public CPDF_Document::Extension,
+ public IXFA_AppProvider {
public:
explicit CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc);
~CPDFXFA_Context() override;