diff options
author | dsinclair <dsinclair@chromium.org> | 2016-08-24 11:12:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-24 11:12:19 -0700 |
commit | cedaa557316a3f5c436814e69d67f19795f471d7 (patch) | |
tree | 128140994288bcd5b01f578e9dafc4bf1ea87493 /core/fpdfapi/fpdf_parser/include/cpdf_document.h | |
parent | ade4b495433751ac853f2d677b9e1da94d0d6bf7 (diff) | |
download | pdfium-cedaa557316a3f5c436814e69d67f19795f471d7.tar.xz |
Flip document and parser ownership
This Cl switches the ownership between the parser and the document. Previously
the parser owned the document and we'd jump through hoops during cleanup to
delete the right object. This Cl flips the ownership so the document owns
the parser and simplifies the cleanup logic where needed.
BUG=pdfium:565
Review-Url: https://codereview.chromium.org/2275773003
Diffstat (limited to 'core/fpdfapi/fpdf_parser/include/cpdf_document.h')
-rw-r--r-- | core/fpdfapi/fpdf_parser/include/cpdf_document.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h index 31988d8c9d..f3322425ed 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h @@ -40,10 +40,10 @@ class JBig2_DocumentContext; class CPDF_Document : public CPDF_IndirectObjectHolder { public: - explicit CPDF_Document(CPDF_Parser* pParser); + explicit CPDF_Document(std::unique_ptr<CPDF_Parser> pParser); ~CPDF_Document() override; - CPDF_Parser* GetParser() const { return m_pParser; } + CPDF_Parser* GetParser() const { return m_pParser.get(); } CPDF_Dictionary* GetRoot() const { return m_pRootDict; } CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } @@ -128,7 +128,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting); CPDF_Object* ParseIndirectObject(uint32_t objnum) override; - CPDF_Parser* m_pParser; + std::unique_ptr<CPDF_Parser> m_pParser; CPDF_Dictionary* m_pRootDict; CPDF_Dictionary* m_pInfoDict; CFX_ByteString m_ID1; |