Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Issue 2442403002: Traverse PDF page tree only once in CPDF_Document Try 2 (Closed)

Created:
4 years, 1 month ago by npm
Modified:
4 years, 1 month ago
Reviewers:
Tom Sepez, Lei Zhang, Wei Li
CC:
pdfium-reviews_googlegroups.com
Target Ref:
refs/heads/master
Project:
pdfium
Visibility:
Public.

Description

Traverse PDF page tree only once in CPDF_Document Try 2: main fix was recursively popping elements from the stack. Since the Traverse method can be called on non-root nodes from GetPage(), we have to make sure to properly update the parents. Try 1 at https://codereview.chromium.org/2414423002/ In our current implementation of CPDF_Document::GetPage, we traverse the PDF page tree until we find the index we are looking for. This is slow when we do calls GetPage(0), GetPage(1), ... since in this case the page tree will be traversed n times if there are n pages. This CL makes sure the page tree is only traversed once. Time to load the PDF from the bug below in chrome official build: Before this CL: around 1 minute 25 seconds After this CL: around 4 seconds BUG=chromium:638513 Committed: https://pdfium.googlesource.com/pdfium/+/d3a2009d75eac3cda442f545ef0865afae7b35cf

Patch Set 1 #

Total comments: 16

Patch Set 2 : Comments #

Total comments: 2

Patch Set 3 : Nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+162 lines, -115 lines) Patch
M core/fpdfapi/parser/cpdf_document.h View 1 3 chunks +16 lines, -5 lines 0 comments Download
M core/fpdfapi/parser/cpdf_document.cpp View 1 2 7 chunks +146 lines, -110 lines 0 comments Download

Messages

Total messages: 24 (15 generated)
npm
PTAL
4 years, 1 month ago (2016-10-24 18:49:32 UTC) #6
npm
Anyone wants to take this? :) Added some comments for clarity https://codereview.chromium.org/2442403002/diff/1/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): ...
4 years, 1 month ago (2016-10-26 15:04:07 UTC) #10
Tom Sepez
https://codereview.chromium.org/2442403002/diff/1/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): https://codereview.chromium.org/2442403002/diff/1/core/fpdfapi/parser/cpdf_document.cpp#newcode406 core/fpdfapi/parser/cpdf_document.cpp:406: m_pTreeTraversal.pop(); Do we know that it's not empty to ...
4 years, 1 month ago (2016-10-26 15:52:23 UTC) #11
npm
https://codereview.chromium.org/2442403002/diff/1/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): https://codereview.chromium.org/2442403002/diff/1/core/fpdfapi/parser/cpdf_document.cpp#newcode406 core/fpdfapi/parser/cpdf_document.cpp:406: m_pTreeTraversal.pop(); On 2016/10/26 15:52:23, Tom Sepez wrote: > Do ...
4 years, 1 month ago (2016-10-26 17:20:19 UTC) #14
Tom Sepez
LGTM. I think this works. Let's give it another shot. https://codereview.chromium.org/2442403002/diff/20001/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): https://codereview.chromium.org/2442403002/diff/20001/core/fpdfapi/parser/cpdf_document.cpp#newcode412 ...
4 years, 1 month ago (2016-10-26 17:24:42 UTC) #15
npm
https://codereview.chromium.org/2442403002/diff/20001/core/fpdfapi/parser/cpdf_document.cpp File core/fpdfapi/parser/cpdf_document.cpp (right): https://codereview.chromium.org/2442403002/diff/20001/core/fpdfapi/parser/cpdf_document.cpp#newcode412 core/fpdfapi/parser/cpdf_document.cpp:412: static_cast<int>(top->first->GetArrayFor("Kids")->GetCount() - 1)) On 2016/10/26 17:24:42, Tom Sepez wrote: ...
4 years, 1 month ago (2016-10-26 17:30:14 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2442403002/40001
4 years, 1 month ago (2016-10-26 17:30:26 UTC) #21
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://pdfium.googlesource.com/pdfium/+/d3a2009d75eac3cda442f545ef0865afae7b35cf
4 years, 1 month ago (2016-10-26 18:03:45 UTC) #23
npm
4 years, 1 month ago (2016-10-28 21:10:40 UTC) #24
Message was sent while issue was closed.
A revert of this CL (patchset #3 id:40001) has been created in
https://codereview.chromium.org/2461063003/ by npm@chromium.org.

The reason for reverting is: Not quite right yet..

Powered by Google App Engine
This is Rietveld 408576698