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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: core/include/fpdfapi/fpdf_parser.h
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index 174430e440b9d1f2c61b267e5dd3081ad8c6ce8d..c5618a0822f0b0c03da2b81ce093ff59ea8b6103 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -7,6 +7,8 @@
#ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
#define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
+#include <map>
+
#include "core/include/fxcrt/fx_system.h"
#include "fpdf_objects.h"
#include "third_party/base/nonstd_unique_ptr.h"
@@ -498,8 +500,6 @@ class CPDF_Parser {
FX_DWORD LoadLinearizedMainXRefTable();
- CFX_MapPtrToPtr m_ObjectStreamMap;
-
CPDF_StreamAcc* GetObjectStream(FX_DWORD number);
FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset);
@@ -543,9 +543,21 @@ class CPDF_Parser {
FX_DWORD m_dwFirstPageNo;
FX_DWORD m_dwXrefStartObjNum;
+
+ 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.
+
+ // Mapping of object numbers to offsets. The offsets are relative to the first
+ // object in the stream.
+ using StreamObjectCache = std::map<FX_DWORD, FX_DWORD>;
+
+ // Mapping of streams to their object caches. This is valid as long as the
+ // streams in |m_ObjectStreamMap| are valid.
+ std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache;
+
friend class CPDF_Creator;
friend class CPDF_DataAvail;
};
+
#define FXCIPHER_NONE 0
#define FXCIPHER_RC4 1
#define FXCIPHER_AES 2

Powered by Google App Engine
This is Rietveld 408576698