From 0024a22b4a793630a1a8e8d85c4525c7b82a3ed7 Mon Sep 17 00:00:00 2001 From: weili Date: Sun, 24 Jul 2016 08:26:49 -0700 Subject: Remove CFX_Deletable Change the last use of CFX_Deletable to its actual type and remove the use of CFX_Deletable. Review-Url: https://codereview.chromium.org/2178613002 --- core/fxcodec/codec/ccodec_jbig2module.h | 20 +++++++++++--------- core/fxcodec/codec/fx_codec_jbig.cpp | 32 ++++++++++---------------------- 2 files changed, 21 insertions(+), 31 deletions(-) (limited to 'core/fxcodec/codec') diff --git a/core/fxcodec/codec/ccodec_jbig2module.h b/core/fxcodec/codec/ccodec_jbig2module.h index 5d77d53619..765a11fcb4 100644 --- a/core/fxcodec/codec/ccodec_jbig2module.h +++ b/core/fxcodec/codec/ccodec_jbig2module.h @@ -16,6 +16,7 @@ class CJBig2_Context; class CJBig2_Image; class CPDF_StreamAcc; class IFX_Pause; +class JBig2_DocumentContext; class CCodec_Jbig2Context { public: @@ -37,15 +38,16 @@ class CCodec_Jbig2Module { CCodec_Jbig2Module() {} ~CCodec_Jbig2Module(); - FXCODEC_STATUS StartDecode(CCodec_Jbig2Context* pJbig2Context, - std::unique_ptr* pContextHolder, - uint32_t width, - uint32_t height, - CPDF_StreamAcc* src_stream, - CPDF_StreamAcc* global_stream, - uint8_t* dest_buf, - uint32_t dest_pitch, - IFX_Pause* pPause); + FXCODEC_STATUS StartDecode( + CCodec_Jbig2Context* pJbig2Context, + std::unique_ptr* pContextHolder, + uint32_t width, + uint32_t height, + CPDF_StreamAcc* src_stream, + CPDF_StreamAcc* global_stream, + uint8_t* dest_buf, + uint32_t dest_pitch, + IFX_Pause* pPause); FXCODEC_STATUS ContinueDecode(CCodec_Jbig2Context* pJbig2Context, IFX_Pause* pPause); }; diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 8f2d07f490..adc57fd1ad 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -9,32 +9,20 @@ #include #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fxcodec/include/JBig2_DocumentContext.h" #include "core/fxcodec/jbig2/JBig2_Context.h" #include "core/fxcodec/jbig2/JBig2_Image.h" #include "core/fxcrt/include/fx_memory.h" -// Holds per-document JBig2 related data. -class JBig2DocumentContext : public CFX_Deletable { - public: - std::list* GetSymbolDictCache() { - return &m_SymbolDictCache; - } - - ~JBig2DocumentContext() override { - for (auto it : m_SymbolDictCache) { - delete it.second; - } - } +JBig2_DocumentContext::JBig2_DocumentContext() {} - private: - std::list m_SymbolDictCache; -}; +JBig2_DocumentContext::~JBig2_DocumentContext() {} -JBig2DocumentContext* GetJBig2DocumentContext( - std::unique_ptr* pContextHolder) { - if (!pContextHolder->get()) - pContextHolder->reset(new JBig2DocumentContext()); - return static_cast(pContextHolder->get()); +JBig2_DocumentContext* GetJBig2DocumentContext( + std::unique_ptr* pContextHolder) { + if (!pContextHolder) + pContextHolder->reset(new JBig2_DocumentContext()); + return pContextHolder->get(); } CCodec_Jbig2Context::CCodec_Jbig2Context() @@ -52,7 +40,7 @@ CCodec_Jbig2Module::~CCodec_Jbig2Module() {} FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( CCodec_Jbig2Context* pJbig2Context, - std::unique_ptr* pContextHolder, + std::unique_ptr* pContextHolder, uint32_t width, uint32_t height, CPDF_StreamAcc* src_stream, @@ -63,7 +51,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( if (!pJbig2Context) return FXCODEC_STATUS_ERR_PARAMS; - JBig2DocumentContext* pJBig2DocumentContext = + JBig2_DocumentContext* pJBig2DocumentContext = GetJBig2DocumentContext(pContextHolder); pJbig2Context->m_width = width; pJbig2Context->m_height = height; -- cgit v1.2.3