From 2aa4b2f3928ccd8393f60db8f7b740c75f4e8a8d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 25 May 2018 22:38:49 +0000 Subject: Make CPDF_Page retainable. Small step to reducing the differences between XFA and non-XFA. We still use the RetainPtr pretty much as if it were an unique_ptr, in that we're not yet caching pages and handing out multiple pointers to the same page in the non-XFA case. The one change is in page view cleanup, where we no longer need a boolean and can take (sufficient) page ownership with a RetainPtr. Tidy up some document.h -> page.h -> document.h circular inclusion while we're at it. NOTE: Wait for imminent branch to pass before landing. We'll want this to bake a while. Change-Id: I64a2f12ac3424ece1063d40583995b834117cf34 Reviewed-on: https://pdfium-review.googlesource.com/32790 Reviewed-by: dsinclair Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fpdfapi/page/cpdf_page.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'core/fpdfapi/page') diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h index 28a12f45b5..0bb99b73f1 100644 --- a/core/fpdfapi/page/cpdf_page.h +++ b/core/fpdfapi/page/cpdf_page.h @@ -10,7 +10,6 @@ #include #include "core/fpdfapi/page/cpdf_pageobjectholder.h" -#include "core/fpdfapi/parser/cpdf_document.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" #include "core/fxcrt/retain_ptr.h" @@ -23,19 +22,13 @@ class CPDF_Object; class CPDF_PageRenderCache; class CPDF_PageRenderContext; -class CPDF_Page : public CPDF_PageObjectHolder { +class CPDF_Page : public Retainable, public CPDF_PageObjectHolder { public: class View {}; // Caller implements as desired, empty here due to layering. + class Extension : public Retainable {}; // XFA page parent class, layering. - // XFA page parent class, layering. - class Extension : public Retainable { - virtual CPDF_Document::Extension* GetDocumentExtension() const = 0; - }; - - CPDF_Page(CPDF_Document* pDocument, - CPDF_Dictionary* pPageDict, - bool bPageCache); - ~CPDF_Page() override; + template + friend RetainPtr pdfium::MakeRetain(Args&&... args); // CPDF_PageObjectHolder: bool IsPage() const override; @@ -71,6 +64,11 @@ class CPDF_Page : public CPDF_PageObjectHolder { void SetPageExtension(Extension* pExt) { m_pPageExtension = pExt; } private: + CPDF_Page(CPDF_Document* pDocument, + CPDF_Dictionary* pPageDict, + bool bPageCache); + ~CPDF_Page() override; + void StartParse(); CPDF_Object* GetPageAttr(const ByteString& name) const; -- cgit v1.2.3