| OLD | NEW | 
|---|
| 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_HINT_TABLES_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_HINT_TABLES_H_ | 
| 8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_HINT_TABLES_H_ | 8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_HINT_TABLES_H_ | 
| 9 | 9 | 
| 10 #include <vector> | 10 #include <vector> | 
| 11 | 11 | 
| 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" | 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" | 
| 13 #include "core/fxcrt/include/fx_basic.h" | 13 #include "core/fxcrt/include/fx_basic.h" | 
| 14 #include "core/fxcrt/include/fx_stream.h" | 14 #include "core/fxcrt/include/fx_stream.h" | 
| 15 | 15 | 
| 16 class CFX_BitStream; | 16 class CFX_BitStream; | 
| 17 class CPDF_Dictionary; | 17 class CPDF_Dictionary; | 
| 18 class CPDF_Stream; | 18 class CPDF_Stream; | 
| 19 | 19 | 
| 20 class CPDF_HintTables { | 20 class CPDF_HintTables { | 
| 21  public: | 21  public: | 
| 22   CPDF_HintTables(CPDF_DataAvail* pDataAvail, CPDF_Dictionary* pLinearized); | 22   CPDF_HintTables(CPDF_DataAvail* pDataAvail, CPDF_Dictionary* pLinearized); | 
| 23   virtual ~CPDF_HintTables(); | 23   virtual ~CPDF_HintTables(); | 
| 24 | 24 | 
| 25   bool GetPagePos(int index, | 25   bool GetPagePos(uint32_t index, | 
| 26                   FX_FILESIZE* szPageStartPos, | 26                   FX_FILESIZE* szPageStartPos, | 
| 27                   FX_FILESIZE* szPageLength, | 27                   FX_FILESIZE* szPageLength, | 
| 28                   uint32_t* dwObjNum); | 28                   uint32_t* dwObjNum); | 
| 29 | 29 | 
| 30   CPDF_DataAvail::DocAvailStatus CheckPage( | 30   CPDF_DataAvail::DocAvailStatus CheckPage( | 
| 31       int index, | 31       uint32_t index, | 
| 32       CPDF_DataAvail::DownloadHints* pHints); | 32       CPDF_DataAvail::DownloadHints* pHints); | 
| 33 | 33 | 
| 34   bool LoadHintStream(CPDF_Stream* pHintStream); | 34   bool LoadHintStream(CPDF_Stream* pHintStream); | 
| 35 | 35 | 
| 36  protected: | 36  protected: | 
| 37   bool ReadPageHintTable(CFX_BitStream* hStream); | 37   bool ReadPageHintTable(CFX_BitStream* hStream); | 
| 38   bool ReadSharedObjHintTable(CFX_BitStream* hStream, uint32_t offset); | 38   bool ReadSharedObjHintTable(CFX_BitStream* hStream, uint32_t offset); | 
| 39   uint32_t GetItemLength(int index, const std::vector<FX_FILESIZE>& szArray); |  | 
| 40 | 39 | 
| 41  private: | 40  private: | 
| 42   // Tests can override. | 41   // Tests can override. | 
| 43   virtual int GetEndOfFirstPageOffset() const; | 42   virtual int GetEndOfFirstPageOffset() const; | 
| 44   virtual int GetNumberOfPages() const; | 43   virtual int GetNumberOfPages() const; | 
| 45   virtual int GetFirstPageObjectNumber() const; | 44   virtual int GetFirstPageObjectNumber() const; | 
| 46   virtual int GetFirstPageNumber() const; | 45   virtual int GetFirstPageNumber() const; | 
| 47   virtual int ReadPrimaryHintStreamOffset() const; | 46   virtual int ReadPrimaryHintStreamOffset() const; | 
| 48   virtual int ReadPrimaryHintStreamLength() const; | 47   virtual int ReadPrimaryHintStreamLength() const; | 
| 49 | 48 | 
| 50   // Helper for the ReadPrimaryHintStream methods above. | 49   // Helper for the ReadPrimaryHintStream methods above. | 
| 51   int ReadPrimaryHintStream(int index) const; | 50   int ReadPrimaryHintStream(int index) const; | 
| 52 | 51 | 
|  | 52   uint32_t GetItemLength(uint32_t index, | 
|  | 53                          const std::vector<FX_FILESIZE>& szArray); | 
|  | 54 | 
| 53   // Owner, outlives this object. | 55   // Owner, outlives this object. | 
| 54   CPDF_DataAvail* const m_pDataAvail; | 56   CPDF_DataAvail* const m_pDataAvail; | 
| 55 | 57 | 
| 56   // Owned by |m_pDataAvail|. | 58   // Owned by |m_pDataAvail|. | 
| 57   CPDF_Dictionary* const m_pLinearizedDict; | 59   CPDF_Dictionary* const m_pLinearizedDict; | 
| 58 | 60 | 
| 59   uint32_t m_nFirstPageSharedObjs; | 61   uint32_t m_nFirstPageSharedObjs; | 
| 60   FX_FILESIZE m_szFirstPageObjOffset; | 62   FX_FILESIZE m_szFirstPageObjOffset; | 
| 61   std::vector<uint32_t> m_dwDeltaNObjsArray; | 63   std::vector<uint32_t> m_dwDeltaNObjsArray; | 
| 62   std::vector<uint32_t> m_dwNSharedObjsArray; | 64   std::vector<uint32_t> m_dwNSharedObjsArray; | 
| 63   std::vector<uint32_t> m_dwSharedObjNumArray; | 65   std::vector<uint32_t> m_dwSharedObjNumArray; | 
| 64   std::vector<uint32_t> m_dwIdentifierArray; | 66   std::vector<uint32_t> m_dwIdentifierArray; | 
| 65   std::vector<FX_FILESIZE> m_szPageOffsetArray; | 67   std::vector<FX_FILESIZE> m_szPageOffsetArray; | 
| 66   std::vector<FX_FILESIZE> m_szSharedObjOffsetArray; | 68   std::vector<FX_FILESIZE> m_szSharedObjOffsetArray; | 
| 67 }; | 69 }; | 
| 68 | 70 | 
| 69 #endif  // CORE_FPDFAPI_FPDF_PARSER_CPDF_HINT_TABLES_H_ | 71 #endif  // CORE_FPDFAPI_FPDF_PARSER_CPDF_HINT_TABLES_H_ | 
| OLD | NEW | 
|---|