diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-05-30 16:40:00 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-30 16:40:00 +0000 |
commit | f0d9d28a034fe3650c3c2d662090c1e8687ddb16 (patch) | |
tree | 6f25857014a0c76445cab264db99f355a4446e3d /fpdfsdk/fpdf_view.cpp | |
parent | 163b4a4117bcc0b2bd1866d32205fbfb9cc01e02 (diff) | |
download | pdfium-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/fpdf_view.cpp')
-rw-r--r-- | fpdfsdk/fpdf_view.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index af9117579d..9af0ca4755 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -354,8 +354,7 @@ FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document, if (!pDict) return nullptr; - auto pPage = pdfium::MakeRetain<CPDF_Page>(pDoc, pDict, true); - pPage->ParseContent(); + RetainPtr<CPDF_Page> pPage = pDoc->GetOrCreatePDFPage(pDict); return FPDFPageFromUnderlying(pPage.Leak()); #endif // PDF_ENABLE_XFA } @@ -962,7 +961,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, if (!pDict) return false; - auto page = pdfium::MakeRetain<CPDF_Page>(pDoc, pDict, true); + RetainPtr<CPDF_Page> page = pDoc->GetOrCreatePDFPage(pDict); *width = page->GetPageWidth(); *height = page->GetPageHeight(); return true; |