From afd0d1f488ea55da545b3310fd8f22e45522a695 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 4 Apr 2017 14:37:18 -0700 Subject: RefCount CPDF_StreamAcc all the time. Pass stream argument to constructor; it feels like a stream accessor should always be made from a stream rather than passing one in after the fact. Change-Id: Iaa46cb37677b81f0170f5d39bab76ad38ea4af44 Reviewed-on: https://pdfium-review.googlesource.com/3620 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fpdfapi/parser/cpdf_stream_acc.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_stream_acc.h') diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h index 51a8a18332..5bfdd186c4 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.h +++ b/core/fpdfapi/parser/cpdf_stream_acc.h @@ -11,19 +11,19 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_stream.h" +#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" -class CPDF_StreamAcc { +class CPDF_StreamAcc : public CFX_Retainable { public: - CPDF_StreamAcc(); - ~CPDF_StreamAcc(); + template + friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); CPDF_StreamAcc(const CPDF_StreamAcc&) = delete; CPDF_StreamAcc& operator=(const CPDF_StreamAcc&) = delete; - void LoadAllData(const CPDF_Stream* pStream, - bool bRawAccess = false, + void LoadAllData(bool bRawAccess = false, uint32_t estimated_size = 0, bool bImageAcc = false); @@ -39,12 +39,15 @@ class CPDF_StreamAcc { std::unique_ptr DetachData(); protected: + explicit CPDF_StreamAcc(const CPDF_Stream* pStream); + ~CPDF_StreamAcc() override; + uint8_t* m_pData; uint32_t m_dwSize; bool m_bNewBuf; CFX_ByteString m_ImageDecoder; CPDF_Dictionary* m_pImageParam; - const CPDF_Stream* m_pStream; + const CPDF_Stream* const m_pStream; uint8_t* m_pSrcData; }; -- cgit v1.2.3