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

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

Issue 2598473002: Use vector of unique_ptrs for page node children. (Closed)
Patch Set: Avoid appearance of infinite loop Created 3 years, 12 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
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_data_avail.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_DATA_AVAIL_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 CPDF_Dictionary* GetPage(int index); 114 CPDF_Dictionary* GetPage(int index);
115 115
116 protected: 116 protected:
117 class PageNode { 117 class PageNode {
118 public: 118 public:
119 PageNode(); 119 PageNode();
120 ~PageNode(); 120 ~PageNode();
121 121
122 PDF_PAGENODE_TYPE m_type; 122 PDF_PAGENODE_TYPE m_type;
123 uint32_t m_dwPageNo; 123 uint32_t m_dwPageNo;
124 CFX_ArrayTemplate<PageNode*> m_childNode; 124 std::vector<std::unique_ptr<PageNode>> m_ChildNodes;
125 }; 125 };
126 126
127 static const int kMaxDataAvailRecursionDepth = 64; 127 static const int kMaxDataAvailRecursionDepth = 64;
128 static int s_CurrentDataAvailRecursionDepth; 128 static int s_CurrentDataAvailRecursionDepth;
129 static const int kMaxPageRecursionDepth = 1024; 129 static const int kMaxPageRecursionDepth = 1024;
130 130
131 uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset); 131 uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset);
132 bool AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array, 132 bool AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
133 bool bParsePage, 133 bool bParsePage,
134 DownloadHints* pHints, 134 DownloadHints* pHints,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 bool LoadAllFile(DownloadHints* pHints); 172 bool LoadAllFile(DownloadHints* pHints);
173 DocAvailStatus CheckLinearizedData(DownloadHints* pHints); 173 DocAvailStatus CheckLinearizedData(DownloadHints* pHints);
174 bool CheckPageAnnots(uint32_t dwPage, DownloadHints* pHints); 174 bool CheckPageAnnots(uint32_t dwPage, DownloadHints* pHints);
175 175
176 DocAvailStatus CheckLinearizedFirstPage(uint32_t dwPage, 176 DocAvailStatus CheckLinearizedFirstPage(uint32_t dwPage,
177 DownloadHints* pHints); 177 DownloadHints* pHints);
178 bool HaveResourceAncestor(CPDF_Dictionary* pDict); 178 bool HaveResourceAncestor(CPDF_Dictionary* pDict);
179 bool CheckPage(uint32_t dwPage, DownloadHints* pHints); 179 bool CheckPage(uint32_t dwPage, DownloadHints* pHints);
180 bool LoadDocPages(DownloadHints* pHints); 180 bool LoadDocPages(DownloadHints* pHints);
181 bool LoadDocPage(uint32_t dwPage, DownloadHints* pHints); 181 bool LoadDocPage(uint32_t dwPage, DownloadHints* pHints);
182 bool CheckPageNode(PageNode& pageNodes, 182 bool CheckPageNode(const PageNode& pageNode,
183 int32_t iPage, 183 int32_t iPage,
184 int32_t& iCount, 184 int32_t& iCount,
185 DownloadHints* pHints, 185 DownloadHints* pHints,
186 int level); 186 int level);
187 bool CheckUnkownPageNode(uint32_t dwPageNo, 187 bool CheckUnknownPageNode(uint32_t dwPageNo,
188 PageNode* pPageNode, 188 PageNode* pPageNode,
189 DownloadHints* pHints); 189 DownloadHints* pHints);
190 bool CheckArrayPageNode(uint32_t dwPageNo, 190 bool CheckArrayPageNode(uint32_t dwPageNo,
191 PageNode* pPageNode, 191 PageNode* pPageNode,
192 DownloadHints* pHints); 192 DownloadHints* pHints);
193 bool CheckPageCount(DownloadHints* pHints); 193 bool CheckPageCount(DownloadHints* pHints);
194 bool IsFirstCheck(uint32_t dwPage); 194 bool IsFirstCheck(uint32_t dwPage);
195 void ResetFirstCheck(uint32_t dwPage); 195 void ResetFirstCheck(uint32_t dwPage);
196 bool ValidatePage(uint32_t dwPage); 196 bool ValidatePage(uint32_t dwPage);
197 bool ValidateForm(); 197 bool ValidateForm();
198 198
199 FileAvail* const m_pFileAvail; 199 FileAvail* const m_pFileAvail;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 CPDF_Dictionary* m_pPageDict; 240 CPDF_Dictionary* m_pPageDict;
241 CPDF_Object* m_pPageResource; 241 CPDF_Object* m_pPageResource;
242 bool m_bNeedDownLoadResource; 242 bool m_bNeedDownLoadResource;
243 bool m_bPageLoadedOK; 243 bool m_bPageLoadedOK;
244 bool m_bLinearizedFormParamLoad; 244 bool m_bLinearizedFormParamLoad;
245 std::vector<std::unique_ptr<CPDF_Object>> m_PagesArray; 245 std::vector<std::unique_ptr<CPDF_Object>> m_PagesArray;
246 uint32_t m_dwEncryptObjNum; 246 uint32_t m_dwEncryptObjNum;
247 FX_FILESIZE m_dwPrevXRefOffset; 247 FX_FILESIZE m_dwPrevXRefOffset;
248 bool m_bTotalLoadPageTree; 248 bool m_bTotalLoadPageTree;
249 bool m_bCurPageDictLoadOK; 249 bool m_bCurPageDictLoadOK;
250 PageNode m_pageNodes; 250 PageNode m_PageNode;
251 std::set<uint32_t> m_pageMapCheckState; 251 std::set<uint32_t> m_pageMapCheckState;
252 std::set<uint32_t> m_pagesLoadState; 252 std::set<uint32_t> m_pagesLoadState;
253 std::unique_ptr<CPDF_HintTables> m_pHintTables; 253 std::unique_ptr<CPDF_HintTables> m_pHintTables;
254 bool m_bSupportHintTable; 254 bool m_bSupportHintTable;
255 }; 255 };
256 256
257 #endif // CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ 257 #endif // CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_data_avail.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698