summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser/include
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-08-22 10:24:43 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-22 10:24:43 -0700
commit8d6c929d2605dc568beb73aab2c585622947fee2 (patch)
tree9144254a1bcd59bad80dd4d06d17a96977966c47 /core/fpdfapi/fpdf_parser/include
parenta4f46c57f4e4217f50e98ac74b360793284ee73f (diff)
downloadpdfium-8d6c929d2605dc568beb73aab2c585622947fee2.tar.xz
Revert of Move parser pointer to CPDF_Document (patchset #6 id:100001 of https://codereview.chromium.org/2253723002/ )
Reason for revert: Causing asan issues. See crbug.com/639451. Original issue's description: > Move parser pointer to CPDF_Document > > The CPDF_IndirectObjectHolder has two subclasses, CPDF_Document and > CFDF_Document. The CPDF document requires the parser and the CFDF document > does not. This cl moves the parser pointer up to CPDF_Document. > > Committed: https://pdfium.googlesource.com/pdfium/+/260f5fbf3553a96fa49b029cc050220039c30e2a TBR=tsepez@chromium.org,thestig@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. Review-Url: https://codereview.chromium.org/2266033002
Diffstat (limited to 'core/fpdfapi/fpdf_parser/include')
-rw-r--r--core/fpdfapi/fpdf_parser/include/cfdf_document.h2
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_document.h4
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h22
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_object.h7
4 files changed, 12 insertions, 23 deletions
diff --git a/core/fpdfapi/fpdf_parser/include/cfdf_document.h b/core/fpdfapi/fpdf_parser/include/cfdf_document.h
index 834aecd1ba..18b9442fa9 100644
--- a/core/fpdfapi/fpdf_parser/include/cfdf_document.h
+++ b/core/fpdfapi/fpdf_parser/include/cfdf_document.h
@@ -19,7 +19,7 @@ class CFDF_Document : public CPDF_IndirectObjectHolder {
static CFDF_Document* ParseFile(IFX_FileRead* pFile,
FX_BOOL bOwnFile = FALSE);
static CFDF_Document* ParseMemory(const uint8_t* pData, uint32_t size);
- ~CFDF_Document() override;
+ ~CFDF_Document();
FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const;
CPDF_Dictionary* GetRoot() const { return m_pRootDict; }
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
index adb8587f4f..4a12ea97dc 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
@@ -40,7 +40,7 @@ class JBig2_DocumentContext;
class CPDF_Document : public CPDF_IndirectObjectHolder {
public:
explicit CPDF_Document(CPDF_Parser* pParser);
- ~CPDF_Document() override;
+ ~CPDF_Document();
CPDF_Parser* GetParser() const { return m_pParser; }
CPDF_Dictionary* GetRoot() const { return m_pRootDict; }
@@ -125,9 +125,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
int& index,
int level = 0);
FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting);
- CPDF_Object* ParseIndirectObject(uint32_t objnum) override;
- CPDF_Parser* m_pParser;
CPDF_Dictionary* m_pRootDict;
CPDF_Dictionary* m_pInfoDict;
CFX_ByteString m_ID1;
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h
index 63fadf19d6..c29746fdd7 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h
@@ -19,32 +19,24 @@ class CPDF_IndirectObjectHolder {
using iterator = std::map<uint32_t, CPDF_Object*>::iterator;
using const_iterator = std::map<uint32_t, CPDF_Object*>::const_iterator;
- CPDF_IndirectObjectHolder();
- virtual ~CPDF_IndirectObjectHolder();
-
- CPDF_Object* GetIndirectObject(uint32_t objnum) const;
- CPDF_Object* GetOrParseIndirectObject(uint32_t objnum);
+ explicit CPDF_IndirectObjectHolder(CPDF_Parser* pParser);
+ ~CPDF_IndirectObjectHolder();
+ CPDF_Object* GetIndirectObject(uint32_t objnum);
+ uint32_t AddIndirectObject(CPDF_Object* pObj);
void ReleaseIndirectObject(uint32_t objnum);
- // The following take ownership of |pObj|.
- uint32_t AddIndirectObject(CPDF_Object* pObj);
- void ReplaceIndirectObject(CPDF_Object* pObj);
- bool ReplaceIndirectObjectIfHigherGeneration(uint32_t objnum,
- CPDF_Object* pObj);
+ // Takes ownership of |pObj|.
+ bool InsertIndirectObject(uint32_t objnum, CPDF_Object* pObj);
uint32_t GetLastObjNum() const { return m_LastObjNum; }
- void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; }
-
iterator begin() { return m_IndirectObjs.begin(); }
const_iterator begin() const { return m_IndirectObjs.begin(); }
iterator end() { return m_IndirectObjs.end(); }
const_iterator end() const { return m_IndirectObjs.end(); }
protected:
- virtual CPDF_Object* ParseIndirectObject(uint32_t objnum);
-
- private:
+ CPDF_Parser* m_pParser;
uint32_t m_LastObjNum;
std::map<uint32_t, CPDF_Object*> m_IndirectObjs;
};
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
index 86f3879ce1..f637e36667 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
@@ -79,10 +79,6 @@ class CPDF_Object {
virtual const CPDF_String* AsString() const;
protected:
- friend class CPDF_Document;
- friend class CPDF_IndirectObjectHolder;
- friend class CPDF_Parser;
-
CPDF_Object() : m_ObjNum(0), m_GenNum(0) {}
virtual ~CPDF_Object();
void Destroy() { delete this; }
@@ -90,6 +86,9 @@ class CPDF_Object {
uint32_t m_ObjNum;
uint32_t m_GenNum;
+ friend class CPDF_IndirectObjectHolder;
+ friend class CPDF_Parser;
+
private:
CPDF_Object(const CPDF_Object& src) {}
};