diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-17 16:38:51 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-17 16:38:51 -0700 |
commit | ff8347a4b16f000be628c5e10d03a1e1c17537eb (patch) | |
tree | 1d46e77a1ef6b28def6af3ffdd576017a6cfe229 /core/src/fxcodec | |
parent | c4d9f6ad2dc922b574862cd2f6f0a899d7e169e3 (diff) | |
download | pdfium-ff8347a4b16f000be628c5e10d03a1e1c17537eb.tar.xz |
Replace some Release() calls with virtual destructors.
A virtual method that does |delete this| is an anti-pattern.
Some classes can be de-virtualized instead.
Throw in some unique_ptrs and delete dead code for good measure.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1192013002.
Diffstat (limited to 'core/src/fxcodec')
-rw-r--r-- | core/src/fxcodec/codec/fx_codec.cpp | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index db95053efd..9bbcce105f 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -7,33 +7,13 @@ #include "../../../include/fxcodec/fx_codec.h" #include "codec_int.h" CCodec_ModuleMgr::CCodec_ModuleMgr() -{ - m_pBasicModule = new CCodec_BasicModule; - m_pFaxModule = new CCodec_FaxModule; - m_pJpegModule = new CCodec_JpegModule; - m_pJpxModule = new CCodec_JpxModule; - m_pJbig2Module = new CCodec_Jbig2Module; - m_pIccModule = new CCodec_IccModule; - m_pFlateModule = new CCodec_FlateModule; -} -CCodec_ModuleMgr::~CCodec_ModuleMgr() -{ - delete m_pBasicModule; - delete m_pFaxModule; - delete m_pJpegModule; - delete m_pFlateModule; - delete m_pJpxModule; - delete m_pJbig2Module; - delete m_pIccModule; -} -void CCodec_ModuleMgr::InitJbig2Decoder() -{ -} -void CCodec_ModuleMgr::InitJpxDecoder() -{ -} -void CCodec_ModuleMgr::InitIccDecoder() -{ + : m_pBasicModule(new CCodec_BasicModule), + m_pFaxModule(new CCodec_FaxModule), + m_pJpegModule(new CCodec_JpegModule), + m_pJpxModule(new CCodec_JpxModule), + m_pJbig2Module(new CCodec_Jbig2Module), + m_pIccModule(new CCodec_IccModule), + m_pFlateModule(new CCodec_FlateModule) { } CCodec_ScanlineDecoder::CCodec_ScanlineDecoder() { @@ -241,14 +221,6 @@ FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, { return FALSE; } -CCodec_ModuleMgr* CCodec_ModuleMgr::Create() -{ - return new CCodec_ModuleMgr; -} -void CCodec_ModuleMgr::Destroy() -{ - delete this; -} class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { public: |