diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-04 14:37:18 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-04 21:48:48 +0000 |
commit | afd0d1f488ea55da545b3310fd8f22e45522a695 (patch) | |
tree | 89136eba4669421b6f828edb9f3d69ee558110d0 /core/fpdfapi/parser/cpdf_stream_acc.h | |
parent | 4f8b044b95dc282959dfe41453e2a9c1ec7e9354 (diff) | |
download | pdfium-afd0d1f488ea55da545b3310fd8f22e45522a695.tar.xz |
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 <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_stream_acc.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_stream_acc.h | 15 |
1 files changed, 9 insertions, 6 deletions
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 <typename T, typename... Args> + friend CFX_RetainPtr<T> 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<uint8_t, FxFreeDeleter> 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; }; |