summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_document_unittest.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-08-23 22:16:13 +0300
committerChromium commit bot <commit-bot@chromium.org>2017-08-29 22:48:11 +0000
commit3fab4e35539e29c4ded08a424db3b1c7fbfa03fc (patch)
tree9fec7999573c13fc0dd9998053b611b14101be49 /core/fpdfapi/parser/cpdf_document_unittest.cpp
parent93e67c955aaa061e80b6fd462592d883051b174c (diff)
downloadpdfium-3fab4e35539e29c4ded08a424db3b1c7fbfa03fc.tar.xz
Optimize receiving page, if it have not obj num.
Make all pages dictionary are not inlined. Original fix: https://codereview.chromium.org/2491583002 Change-Id: Ie3aa662182a70ef6ef1d6121c0576c171e0060dd Reviewed-on: https://pdfium-review.googlesource.com/11810 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document_unittest.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_document_unittest.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp
index 2715508015..9e03c96697 100644
--- a/core/fpdfapi/parser/cpdf_document_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp
@@ -113,7 +113,7 @@ class CPDF_TestDocumentWithPageWithoutPageNum : public CPDF_Document {
allPages->AddNew<CPDF_Reference>(
this, AddIndirectObject(CreateNumberedPage(1))->GetObjNum());
// Page without pageNum.
- allPages->Add(CreateNumberedPage(2));
+ inlined_page_ = allPages->Add(CreateNumberedPage(2));
CPDF_Dictionary* pagesDict =
CreatePageTreeNode(std::move(allPages), this, 3);
m_pOwnedRootDict = pdfium::MakeUnique<CPDF_Dictionary>();
@@ -123,8 +123,11 @@ class CPDF_TestDocumentWithPageWithoutPageNum : public CPDF_Document {
m_PageList.resize(3);
}
+ const CPDF_Object* inlined_page() const { return inlined_page_; }
+
private:
std::unique_ptr<CPDF_Dictionary> m_pOwnedRootDict;
+ const CPDF_Object* inlined_page_;
};
class TestLinearized : public CPDF_LinearizedHeader {
@@ -171,12 +174,11 @@ TEST_F(cpdf_document_test, GetPages) {
}
TEST_F(cpdf_document_test, GetPageWithoutObjNumTwice) {
- std::unique_ptr<CPDF_TestDocumentWithPageWithoutPageNum> document =
- pdfium::MakeUnique<CPDF_TestDocumentWithPageWithoutPageNum>();
+ auto document = pdfium::MakeUnique<CPDF_TestDocumentWithPageWithoutPageNum>();
const CPDF_Dictionary* page = document->GetPage(2);
ASSERT_TRUE(page);
- // This is page without obj num.
- ASSERT_EQ(0ul, page->GetObjNum());
+ ASSERT_EQ(document->inlined_page(), page);
+
const CPDF_Dictionary* second_call_page = document->GetPage(2);
EXPECT_TRUE(second_call_page);
EXPECT_EQ(page, second_call_page);