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

Unified Diff: core/fpdfapi/parser/cpdf_document.h

Issue 2442403002: Traverse PDF page tree only once in CPDF_Document Try 2 (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_document.cpp » ('j') | core/fpdfapi/parser/cpdf_document.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_document.h
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index ea7bd328aa4302dc28261cada6babc634d505a9a..d7fe2f1ffa57041c3ec536d657a2dc6bb76c4371 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -9,6 +9,7 @@
#include <functional>
#include <memory>
+#include <stack>
#include "core/fpdfapi/parser/cpdf_indirect_object_holder.h"
#include "core/fpdfapi/parser/cpdf_object.h"
@@ -105,10 +106,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
protected:
// Retrieve page count information by getting count value from the tree nodes
int RetrievePageCount() const;
- CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages,
- int iPage,
- int nPagesToGo,
- int level);
+ CPDF_Dictionary* TraversePDFPages(int iPage, int nPagesToGo);
int FindPageIndex(CPDF_Dictionary* pNode,
uint32_t& skip_count,
uint32_t objnum,
@@ -124,10 +122,20 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
FX_BOOL bVert,
CFX_ByteString basefont,
std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert);
-
+ int InsertDeletePDFPage(CPDF_Dictionary* pPages,
+ int nPagesToGo,
+ CPDF_Dictionary* pPage,
+ FX_BOOL bInsert,
+ std::set<CPDF_Dictionary*>* pVisited);
+ int InsertNewPage(int iPage,
+ CPDF_Dictionary* pPageDict,
+ CFX_ArrayTemplate<uint32_t>& pageList);
+ void PopAndPropagate();
std::unique_ptr<CPDF_Parser> m_pParser;
CPDF_Dictionary* m_pRootDict;
CPDF_Dictionary* m_pInfoDict;
+ std::stack<std::pair<CPDF_Dictionary*, int>> m_pTreeTraversal;
npm 2016/10/26 15:04:06 Stack of page nodes to know current position in pa
Tom Sepez 2016/10/26 15:52:23 nit: you might add this as a comment.
npm 2016/10/26 17:20:18 Done.
+ int m_iLastPageTraversed;
npm 2016/10/26 15:04:06 Represents the index of the last page (leaf) proce
Tom Sepez 2016/10/26 15:52:23 nit: // Index of last page (leaf) processed from p
npm 2016/10/26 17:20:18 Done.
bool m_bLinearized;
int m_iFirstPageNo;
uint32_t m_dwFirstPageObjNum;
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_document.cpp » ('j') | core/fpdfapi/parser/cpdf_document.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698