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_parser.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_parser.h')
-rw-r--r-- | core/fpdfapi/fpdf_parser/include/cpdf_parser.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h index a69f0fe38e..d6a5d5703b 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h @@ -37,17 +37,14 @@ class CPDF_Parser { CPDF_Parser(); ~CPDF_Parser(); - Error StartParse(IFX_FileRead* pFile, - std::unique_ptr<CPDF_Document> pDocument); - - Error StartLinearizedParse(IFX_FileRead* pFile, - std::unique_ptr<CPDF_Document> pDocument); + Error StartParse(IFX_FileRead* pFile, CPDF_Document* pDocument); + Error StartLinearizedParse(IFX_FileRead* pFile, CPDF_Document* pDocument); void SetPassword(const FX_CHAR* password) { m_Password = password; } CFX_ByteString GetPassword() { return m_Password; } CPDF_Dictionary* GetTrailer() const { return m_pTrailer; } FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } - CPDF_Document* GetDocument() const { return m_pDocument.get(); } + CPDF_Document* GetDocument() const { return m_pDocument; } uint32_t GetPermissions() const; uint32_t GetRootObjNum(); @@ -120,7 +117,7 @@ class CPDF_Parser { // the objects. bool VerifyCrossRefV4(); - std::unique_ptr<CPDF_Document> m_pDocument; + CPDF_Document* m_pDocument; // not owned std::unique_ptr<CPDF_SyntaxParser> m_pSyntax; bool m_bOwnFileRead; int m_FileVersion; |