summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa/cpdfxfa_page.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-16 14:11:30 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-16 21:51:53 +0000
commit9792f16f3ef27a1e0c7f0526cc69637a158e3010 (patch)
tree861baddf94e96d7de9bc2c2b27409872d56ebcee /fpdfsdk/fpdfxfa/cpdfxfa_page.h
parentcc205131b021ebded854958973f445ed121da1b8 (diff)
downloadpdfium-9792f16f3ef27a1e0c7f0526cc69637a158e3010.tar.xz
Properly ref-count CPDFXFA_Page
Change-Id: Ibd1ebe4191f61e20d815de7f1a1094d78b72e6a7 Reviewed-on: https://pdfium-review.googlesource.com/5391 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_page.h')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
index 05b9238eb7..d990813282 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
@@ -9,6 +9,7 @@
#include <memory>
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_system.h"
class CFX_Matrix;
@@ -17,15 +18,10 @@ class CPDF_Dictionary;
class CPDF_Page;
class CXFA_FFPageView;
-class CPDFXFA_Page {
+class CPDFXFA_Page : public CFX_Retainable {
public:
- CPDFXFA_Page(CPDFXFA_Context* pContext, int page_index);
-
- void Retain() { m_iRef++; }
- void Release() {
- if (--m_iRef <= 0)
- delete this;
- }
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
bool LoadPage();
bool LoadPDFPage(CPDF_Dictionary* pageDict);
@@ -68,7 +64,8 @@ class CPDFXFA_Page {
protected:
// Refcounted class.
- ~CPDFXFA_Page();
+ CPDFXFA_Page(CPDFXFA_Context* pContext, int page_index);
+ ~CPDFXFA_Page() override;
bool LoadPDFPage();
bool LoadXFAPageView();