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

Side by Side Diff: core/fpdfapi/parser/cpdf_document.h

Issue 2414423002: Traverse PDF page tree only once in CPDF_Document (Closed)
Patch Set: Nits 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_
9 9
10 #include <functional> 10 #include <functional>
11 #include <memory> 11 #include <memory>
12 #include <stack>
12 13
13 #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" 14 #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h"
14 #include "core/fpdfapi/parser/cpdf_object.h" 15 #include "core/fpdfapi/parser/cpdf_object.h"
15 #include "core/fpdfdoc/cpdf_linklist.h" 16 #include "core/fpdfdoc/cpdf_linklist.h"
16 #include "core/fxcrt/cfx_string_pool_template.h" 17 #include "core/fxcrt/cfx_string_pool_template.h"
17 #include "core/fxcrt/cfx_weak_ptr.h" 18 #include "core/fxcrt/cfx_weak_ptr.h"
18 #include "core/fxcrt/fx_basic.h" 19 #include "core/fxcrt/fx_basic.h"
19 20
20 class CFX_Font; 21 class CFX_Font;
21 class CFX_Matrix; 22 class CFX_Matrix;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert); 96 CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert);
96 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 97 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
97 CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont, 98 CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont,
98 FX_BOOL bVert, 99 FX_BOOL bVert,
99 FX_BOOL bTranslateName = FALSE); 100 FX_BOOL bTranslateName = FALSE);
100 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, 101 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont,
101 FX_BOOL bVert, 102 FX_BOOL bVert,
102 FX_BOOL bTranslateName = FALSE); 103 FX_BOOL bTranslateName = FALSE);
103 #endif 104 #endif
104 105
106 std::stack<std::pair<CPDF_Dictionary*, int>> m_pTreeTraversal;
107 int m_iLastPageTraversed;
dsinclair 2016/10/18 13:35:59 Should these two members be private?
npm 2016/10/18 14:26:31 Since I needed to reset them in namespace method I
108
105 private: 109 private:
106 friend class CPDF_TestDocument; 110 friend class CPDF_TestDocument;
107 111
108 // Retrieve page count information by getting count value from the tree nodes 112 // Retrieve page count information by getting count value from the tree nodes
109 int RetrievePageCount() const; 113 int RetrievePageCount() const;
110 CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages, 114 CPDF_Dictionary* TraversePDFPages(int iPage, int nPagesToGo);
111 int iPage,
112 int nPagesToGo,
113 int level);
114 int FindPageIndex(CPDF_Dictionary* pNode, 115 int FindPageIndex(CPDF_Dictionary* pNode,
115 uint32_t& skip_count, 116 uint32_t& skip_count,
116 uint32_t objnum, 117 uint32_t objnum,
117 int& index, 118 int& index,
118 int level = 0); 119 int level = 0);
119 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; 120 CPDF_Object* ParseIndirectObject(uint32_t objnum) override;
120 void LoadDocInternal(); 121 void LoadDocInternal();
121 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); 122 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict);
122 CPDF_Dictionary* GetPagesDict() const; 123 CPDF_Dictionary* GetPagesDict() const;
123 CPDF_Dictionary* ProcessbCJK( 124 CPDF_Dictionary* ProcessbCJK(
(...skipping 12 matching lines...) Expand all
136 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. 137 // TODO(thestig): Figure out why this cannot be a std::unique_ptr.
137 CPDF_DocPageData* m_pDocPage; 138 CPDF_DocPageData* m_pDocPage;
138 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; 139 std::unique_ptr<CPDF_DocRenderData> m_pDocRender;
139 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; 140 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext;
140 std::unique_ptr<CPDF_LinkList> m_pLinksContext; 141 std::unique_ptr<CPDF_LinkList> m_pLinksContext;
141 CFX_ArrayTemplate<uint32_t> m_PageList; 142 CFX_ArrayTemplate<uint32_t> m_PageList;
142 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; 143 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool;
143 }; 144 };
144 145
145 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ 146 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_
OLDNEW
« 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