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

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

Issue 1458633004: Cache object numbers in CPDF_Parser::ParseIndirectObject(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 1 month 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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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_INCLUDE_FPDFAPI_FPDF_PARSER_H_ 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
9 9
10 #include <map>
11
10 #include "core/include/fxcrt/fx_system.h" 12 #include "core/include/fxcrt/fx_system.h"
11 #include "fpdf_objects.h" 13 #include "fpdf_objects.h"
12 #include "third_party/base/nonstd_unique_ptr.h" 14 #include "third_party/base/nonstd_unique_ptr.h"
13 15
14 class CFDF_Document; 16 class CFDF_Document;
15 class CFDF_Parser; 17 class CFDF_Parser;
16 class CFX_AffineMatrix; 18 class CFX_AffineMatrix;
17 class CFX_DIBSource; 19 class CFX_DIBSource;
18 class CFX_FloatRect; 20 class CFX_FloatRect;
19 class CFX_Font; 21 class CFX_Font;
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 void ReleaseEncryptHandler(); 493 void ReleaseEncryptHandler();
492 494
493 FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); 495 FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount);
494 496
495 FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); 497 FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount);
496 498
497 FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); 499 FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos);
498 500
499 FX_DWORD LoadLinearizedMainXRefTable(); 501 FX_DWORD LoadLinearizedMainXRefTable();
500 502
501 CFX_MapPtrToPtr m_ObjectStreamMap;
502
503 CPDF_StreamAcc* GetObjectStream(FX_DWORD number); 503 CPDF_StreamAcc* GetObjectStream(FX_DWORD number);
504 504
505 FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset); 505 FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset);
506 506
507 bool FindPosInOffsets(FX_FILESIZE pos) const; 507 bool FindPosInOffsets(FX_FILESIZE pos) const;
508 508
509 int m_FileVersion; 509 int m_FileVersion;
510 510
511 CPDF_Dictionary* m_pTrailer; 511 CPDF_Dictionary* m_pTrailer;
512 512
(...skipping 23 matching lines...) Expand all
536 CFX_WordArray m_ObjVersion; 536 CFX_WordArray m_ObjVersion;
537 CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers; 537 CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers;
538 538
539 FX_BOOL m_bVersionUpdated; 539 FX_BOOL m_bVersionUpdated;
540 540
541 CPDF_Object* m_pLinearized; 541 CPDF_Object* m_pLinearized;
542 542
543 FX_DWORD m_dwFirstPageNo; 543 FX_DWORD m_dwFirstPageNo;
544 544
545 FX_DWORD m_dwXrefStartObjNum; 545 FX_DWORD m_dwXrefStartObjNum;
546
547 CFX_MapPtrToPtr m_ObjectStreamMap;
Tom Sepez 2015/11/19 16:46:25 nit: wish we had a comment about what this map doe
Lei Zhang 2015/11/20 07:11:42 Added, and likely yes.
548
549 // Mapping of object numbers to offsets. The offsets are relative to the first
550 // object in the stream.
551 using StreamObjectCache = std::map<FX_DWORD, FX_DWORD>;
552
553 // Mapping of streams to their object caches. This is valid as long as the
554 // streams in |m_ObjectStreamMap| are valid.
555 std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache;
556
546 friend class CPDF_Creator; 557 friend class CPDF_Creator;
547 friend class CPDF_DataAvail; 558 friend class CPDF_DataAvail;
548 }; 559 };
560
549 #define FXCIPHER_NONE 0 561 #define FXCIPHER_NONE 0
550 #define FXCIPHER_RC4 1 562 #define FXCIPHER_RC4 1
551 #define FXCIPHER_AES 2 563 #define FXCIPHER_AES 2
552 #define FXCIPHER_AES2 3 564 #define FXCIPHER_AES2 3
553 class CPDF_SecurityHandler { 565 class CPDF_SecurityHandler {
554 public: 566 public:
555 virtual ~CPDF_SecurityHandler() {} 567 virtual ~CPDF_SecurityHandler() {}
556 568
557 virtual FX_BOOL OnInit(CPDF_Parser* pParser, 569 virtual FX_BOOL OnInit(CPDF_Parser* pParser,
558 CPDF_Dictionary* pEncryptDict) = 0; 570 CPDF_Dictionary* pEncryptDict) = 0;
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 FX_DWORD src_size, 1007 FX_DWORD src_size,
996 const CPDF_Dictionary* pDict, 1008 const CPDF_Dictionary* pDict,
997 uint8_t*& dest_buf, 1009 uint8_t*& dest_buf,
998 FX_DWORD& dest_size, 1010 FX_DWORD& dest_size,
999 CFX_ByteString& ImageEncoding, 1011 CFX_ByteString& ImageEncoding,
1000 CPDF_Dictionary*& pImageParms, 1012 CPDF_Dictionary*& pImageParms,
1001 FX_DWORD estimated_size, 1013 FX_DWORD estimated_size,
1002 FX_BOOL bImageAcc); 1014 FX_BOOL bImageAcc);
1003 1015
1004 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ 1016 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698