From 9f7b5e1b5e0dfd7310a2eb9e586bc998f8ea11fa Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 7 Mar 2016 14:55:02 -0800 Subject: Completely de-virtualize CPDF_SyntaxParser. It isn't sub-classed. Making GetNextChar() non-virtual may save a virtual fn call per character if the compilers aren't able to do so themselves. Make members private, not protected. BUG= R=ochang@chromium.org Review URL: https://codereview.chromium.org/1772973002 . --- core/include/fpdfapi/fpdf_objects.h | 1 - core/include/fpdfapi/fpdf_parser.h | 15 ++++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index 6047e36b94..58d98e5436 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -97,7 +97,6 @@ class CPDF_Object { friend class CPDF_IndirectObjectHolder; friend class CPDF_Parser; - friend class CPDF_SyntaxParser; private: CPDF_Object(const CPDF_Object& src) {} diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index 5903e82a16..b554673d80 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -234,7 +234,7 @@ class CPDF_SimpleParser { class CPDF_SyntaxParser { public: CPDF_SyntaxParser(); - virtual ~CPDF_SyntaxParser(); + ~CPDF_SyntaxParser(); void InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOffset); @@ -268,7 +268,7 @@ class CPDF_SyntaxParser { FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); CFX_ByteString GetNextWord(bool* bIsNumber); - protected: + private: friend class CPDF_Parser; friend class CPDF_DataAvail; friend class fpdf_parser_parser_ReadHexString_Test; @@ -276,23 +276,19 @@ class CPDF_SyntaxParser { static const int kParserMaxRecursionDepth = 64; static int s_CurrentRecursionDepth; - virtual FX_BOOL GetNextChar(uint8_t& ch); + uint32_t GetDirectNum(); + FX_BOOL GetNextChar(uint8_t& ch); FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); - void GetNextWordInternal(bool* bIsNumber); - bool IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const CFX_ByteStringC& tag, FX_BOOL checkKeyword); CFX_ByteString ReadString(); - CFX_ByteString ReadHexString(); - unsigned int ReadEOLMarkers(FX_FILESIZE pos); - CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, FX_DWORD objnum, FX_DWORD gennum); @@ -308,9 +304,6 @@ class CPDF_SyntaxParser { std::unique_ptr m_pCryptoHandler; uint8_t m_WordBuffer[257]; FX_DWORD m_WordSize; - - private: - uint32_t GetDirectNum(); }; class CPDF_Parser { -- cgit v1.2.3