summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa
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 /fpdfsdk/fpdfxfa
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 'fpdfsdk/fpdfxfa')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 4d7e3bc222..f4120896a8 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -34,10 +34,9 @@ bool CPDFXFA_Page::LoadPDFPage() {
if (!pDict)
return false;
- if (!m_pPDFPage || m_pPDFPage->GetFormDict() != pDict) {
- m_pPDFPage = pdfium::MakeRetain<CPDF_Page>(pPDFDoc, pDict, true);
- m_pPDFPage->ParseContent();
- }
+ if (!m_pPDFPage || m_pPDFPage->GetFormDict() != pDict)
+ m_pPDFPage = pPDFDoc->GetOrCreatePDFPage(pDict);
+
return true;
}
@@ -80,9 +79,7 @@ bool CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) {
if (!m_pContext || m_iPageIndex < 0 || !pageDict)
return false;
- m_pPDFPage =
- pdfium::MakeRetain<CPDF_Page>(m_pContext->GetPDFDoc(), pageDict, true);
- m_pPDFPage->ParseContent();
+ m_pPDFPage = m_pContext->GetPDFDoc()->GetOrCreatePDFPage(pageDict);
return true;
}