summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-30 16:40:00 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-30 16:40:00 +0000
commitf0d9d28a034fe3650c3c2d662090c1e8687ddb16 (patch)
tree6f25857014a0c76445cab264db99f355a4446e3d /core/fpdfapi/page
parent163b4a4117bcc0b2bd1866d32205fbfb9cc01e02 (diff)
downloadpdfium-f0d9d28a034fe3650c3c2d662090c1e8687ddb16.tar.xz
Make CPDF_Document cache CPDF_Pages
We cache pages not by page number, which can bounce around as pages are inserted or removed, but by page dictionary's object number. Since the page may be created under one function and used under another, we can't take the shortcut of not instantiating a render cache nor not parsing the page. Change-Id: I9a325cda8b3141153544ac53e78a51a44e6b411a Reviewed-on: https://pdfium-review.googlesource.com/32830 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_page.h7
2 files changed, 7 insertions, 4 deletions
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 7c0a3234c9..c5c85635b2 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -21,11 +21,11 @@
CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
CPDF_Dictionary* pPageDict,
- bool bPageCache)
+ bool bUseRenderCache)
: CPDF_PageObjectHolder(pDocument, pPageDict),
m_PageSize(100, 100),
m_pPDFDocument(pDocument) {
- if (bPageCache)
+ if (bUseRenderCache)
m_pPageRender = pdfium::MakeUnique<CPDF_PageRenderCache>(this);
if (!pPageDict)
return;
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h
index 0bb99b73f1..b94326e47b 100644
--- a/core/fpdfapi/page/cpdf_page.h
+++ b/core/fpdfapi/page/cpdf_page.h
@@ -12,6 +12,7 @@
#include "core/fpdfapi/page/cpdf_pageobjectholder.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/observable.h"
#include "core/fxcrt/retain_ptr.h"
#include "core/fxcrt/unowned_ptr.h"
#include "third_party/base/optional.h"
@@ -22,7 +23,9 @@ class CPDF_Object;
class CPDF_PageRenderCache;
class CPDF_PageRenderContext;
-class CPDF_Page : public Retainable, public CPDF_PageObjectHolder {
+class CPDF_Page : public Retainable,
+ public Observable<CPDF_Page>,
+ public CPDF_PageObjectHolder {
public:
class View {}; // Caller implements as desired, empty here due to layering.
class Extension : public Retainable {}; // XFA page parent class, layering.
@@ -66,7 +69,7 @@ class CPDF_Page : public Retainable, public CPDF_PageObjectHolder {
private:
CPDF_Page(CPDF_Document* pDocument,
CPDF_Dictionary* pPageDict,
- bool bPageCache);
+ bool bUseRenderCache);
~CPDF_Page() override;
void StartParse();