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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: windows compile 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_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_ 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_ 8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "core/fxcrt/include/cfx_string_pool_template.h"
13 #include "core/fxcrt/include/cfx_weak_ptr.h"
12 #include "core/fxcrt/include/fx_basic.h" 14 #include "core/fxcrt/include/fx_basic.h"
13 15
14 class CPDF_CryptoHandler; 16 class CPDF_CryptoHandler;
15 class CPDF_Dictionary; 17 class CPDF_Dictionary;
16 class CPDF_IndirectObjectHolder; 18 class CPDF_IndirectObjectHolder;
17 class CPDF_Object; 19 class CPDF_Object;
18 class CPDF_Stream; 20 class CPDF_Stream;
19 class IFX_FileRead; 21 class IFX_FileRead;
20 22
21 class CPDF_SyntaxParser { 23 class CPDF_SyntaxParser {
22 public: 24 public:
23 CPDF_SyntaxParser(); 25 CPDF_SyntaxParser();
26 explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
24 ~CPDF_SyntaxParser(); 27 ~CPDF_SyntaxParser();
25 28
26 void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset); 29 void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset);
27 30
28 FX_FILESIZE SavePos() const { return m_Pos; } 31 FX_FILESIZE SavePos() const { return m_Pos; }
29 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } 32 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; }
30 33
31 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, 34 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList,
32 uint32_t objnum, 35 uint32_t objnum,
33 uint32_t gennum, 36 uint32_t gennum,
(...skipping 23 matching lines...) Expand all
57 60
58 private: 61 private:
59 friend class CPDF_Parser; 62 friend class CPDF_Parser;
60 friend class CPDF_DataAvail; 63 friend class CPDF_DataAvail;
61 friend class cpdf_syntax_parser_ReadHexString_Test; 64 friend class cpdf_syntax_parser_ReadHexString_Test;
62 65
63 static const int kParserMaxRecursionDepth = 64; 66 static const int kParserMaxRecursionDepth = 64;
64 static int s_CurrentRecursionDepth; 67 static int s_CurrentRecursionDepth;
65 68
66 uint32_t GetDirectNum(); 69 uint32_t GetDirectNum();
67
68 FX_BOOL GetNextChar(uint8_t& ch); 70 FX_BOOL GetNextChar(uint8_t& ch);
69 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); 71 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch);
70 void GetNextWordInternal(bool* bIsNumber); 72 void GetNextWordInternal(bool* bIsNumber);
71 bool IsWholeWord(FX_FILESIZE startpos, 73 bool IsWholeWord(FX_FILESIZE startpos,
72 FX_FILESIZE limit, 74 FX_FILESIZE limit,
73 const CFX_ByteStringC& tag, 75 const CFX_ByteStringC& tag,
74 FX_BOOL checkKeyword); 76 FX_BOOL checkKeyword);
75 77
76 CFX_ByteString ReadString(); 78 CFX_ByteString ReadString();
77 CFX_ByteString ReadHexString(); 79 CFX_ByteString ReadHexString();
78 unsigned int ReadEOLMarkers(FX_FILESIZE pos); 80 unsigned int ReadEOLMarkers(FX_FILESIZE pos);
79 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, 81 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict,
80 uint32_t objnum, 82 uint32_t objnum,
81 uint32_t gennum); 83 uint32_t gennum);
82 84
85 CFX_ByteString MaybeIntern(const CFX_ByteString& str);
86
83 FX_FILESIZE m_Pos; 87 FX_FILESIZE m_Pos;
84 int m_MetadataObjnum; 88 int m_MetadataObjnum;
85 IFX_FileRead* m_pFileAccess; 89 IFX_FileRead* m_pFileAccess;
86 FX_FILESIZE m_HeaderOffset; 90 FX_FILESIZE m_HeaderOffset;
87 FX_FILESIZE m_FileLen; 91 FX_FILESIZE m_FileLen;
88 uint8_t* m_pFileBuf; 92 uint8_t* m_pFileBuf;
89 uint32_t m_BufSize; 93 uint32_t m_BufSize;
90 FX_FILESIZE m_BufOffset; 94 FX_FILESIZE m_BufOffset;
91 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; 95 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler;
92 uint8_t m_WordBuffer[257]; 96 uint8_t m_WordBuffer[257];
93 uint32_t m_WordSize; 97 uint32_t m_WordSize;
98 CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
94 }; 99 };
95 100
96 #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_ 101 #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_stream.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698