From 6088612c21898eb79cfbde401984176dd94c385c Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 3 Apr 2017 15:40:22 -0700 Subject: RefCount CPDF_IccProfile all the time Make the IccProfile track its stream so that it has a proper key with which to purge the docpagedata map. Change-Id: Ib05ebc1afb828f1f5e5df62a1a33a1bfdecf507d Reviewed-on: https://pdfium-review.googlesource.com/3619 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fpdfapi/page/pageint.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'core/fpdfapi/page/pageint.h') diff --git a/core/fpdfapi/page/pageint.h b/core/fpdfapi/page/pageint.h index 9637155343..a7a00f02ee 100644 --- a/core/fpdfapi/page/pageint.h +++ b/core/fpdfapi/page/pageint.h @@ -12,11 +12,13 @@ #include "core/fpdfapi/page/cpdf_colorspace.h" #include "core/fpdfapi/page/cpdf_countedobject.h" +#include "core/fxcrt/cfx_retain_ptr.h" class CPDF_ExpIntFunc; class CPDF_Pattern; class CPDF_SampledFunc; class CPDF_StitchFunc; +class CPDF_Stream; class CPDF_StreamAcc; class CPDF_Function { @@ -134,11 +136,12 @@ class CPDF_StitchFunc : public CPDF_Function { static const uint32_t kRequiredNumInputs = 1; }; -class CPDF_IccProfile { +class CPDF_IccProfile : public CFX_Retainable { public: - CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize); - ~CPDF_IccProfile(); + template + friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + CPDF_Stream* GetStream() const { return m_pStream; } bool IsValid() const { return IsSRGB() || IsSupported(); } bool IsSRGB() const { return m_bsRGB; } bool IsSupported() const { return !!m_pTransform; } @@ -146,7 +149,11 @@ class CPDF_IccProfile { uint32_t GetComponents() const { return m_nSrcComponents; } private: + CPDF_IccProfile(CPDF_Stream* pStream, const uint8_t* pData, uint32_t dwSize); + ~CPDF_IccProfile() override; + const bool m_bsRGB; + CPDF_Stream* const m_pStream; void* m_pTransform = nullptr; uint32_t m_nSrcComponents = 0; }; -- cgit v1.2.3