summaryrefslogtreecommitdiff
path: root/core/include/fxcodec/fx_codec.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-17 16:38:51 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-17 16:38:51 -0700
commitff8347a4b16f000be628c5e10d03a1e1c17537eb (patch)
tree1d46e77a1ef6b28def6af3ffdd576017a6cfe229 /core/include/fxcodec/fx_codec.h
parentc4d9f6ad2dc922b574862cd2f6f0a899d7e169e3 (diff)
downloadpdfium-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/include/fxcodec/fx_codec.h')
-rw-r--r--core/include/fxcodec/fx_codec.h70
1 files changed, 18 insertions, 52 deletions
diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h
index e8faf3f78f..e3d69e5dc9 100644
--- a/core/include/fxcodec/fx_codec.h
+++ b/core/include/fxcodec/fx_codec.h
@@ -7,6 +7,7 @@
#ifndef CORE_INCLUDE_FXCODEC_FX_CODEC_H_
#define CORE_INCLUDE_FXCODEC_FX_CODEC_H_
+#include "../../../third_party/base/nonstd_unique_ptr.h"
#include "../fxcrt/fx_basic.h"
#include "fx_codec_def.h"
#include "fx_codec_provider.h"
@@ -22,63 +23,28 @@ class ICodec_IccModule;
class ICodec_FlateModule;
class ICodec_Jbig2Encoder;
class ICodec_ScanlineDecoder;
+
class CCodec_ModuleMgr
{
public:
-
- static CCodec_ModuleMgr* Create();
-
- void Destroy();
-
- void InitJbig2Decoder();
-
- void InitJpxDecoder();
-
-
- void InitIccDecoder();
-
- ICodec_Jbig2Encoder* CreateJbig2Encoder();
-protected:
CCodec_ModuleMgr();
- ~CCodec_ModuleMgr();
-public:
- ICodec_BasicModule* GetBasicModule()
- {
- return m_pBasicModule;
- }
- ICodec_FaxModule* GetFaxModule()
- {
- return m_pFaxModule;
- }
- ICodec_JpegModule* GetJpegModule()
- {
- return m_pJpegModule;
- }
- ICodec_JpxModule* GetJpxModule()
- {
- return m_pJpxModule;
- }
- ICodec_Jbig2Module* GetJbig2Module()
- {
- return m_pJbig2Module;
- }
- ICodec_IccModule* GetIccModule()
- {
- return m_pIccModule;
- }
- ICodec_FlateModule* GetFlateModule()
- {
- return m_pFlateModule;
- }
-protected:
- ICodec_BasicModule* m_pBasicModule;
- ICodec_FaxModule* m_pFaxModule;
- ICodec_JpegModule* m_pJpegModule;
- ICodec_JpxModule* m_pJpxModule;
- ICodec_Jbig2Module* m_pJbig2Module;
- ICodec_IccModule* m_pIccModule;
- ICodec_FlateModule* m_pFlateModule;
+ ICodec_Jbig2Encoder* CreateJbig2Encoder();
+ ICodec_BasicModule* GetBasicModule() const { return m_pBasicModule.get(); }
+ ICodec_FaxModule* GetFaxModule() const { return m_pFaxModule.get(); }
+ ICodec_JpegModule* GetJpegModule() const { return m_pJpegModule.get(); }
+ ICodec_JpxModule* GetJpxModule() const { return m_pJpxModule.get(); }
+ ICodec_Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); }
+ ICodec_IccModule* GetIccModule() const { return m_pIccModule.get(); }
+ ICodec_FlateModule* GetFlateModule() const { return m_pFlateModule.get(); }
+protected:
+ nonstd::unique_ptr<ICodec_BasicModule> m_pBasicModule;
+ nonstd::unique_ptr<ICodec_FaxModule> m_pFaxModule;
+ nonstd::unique_ptr<ICodec_JpegModule> m_pJpegModule;
+ nonstd::unique_ptr<ICodec_JpxModule> m_pJpxModule;
+ nonstd::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module;
+ nonstd::unique_ptr<ICodec_IccModule> m_pIccModule;
+ nonstd::unique_ptr<ICodec_FlateModule> m_pFlateModule;
};
class ICodec_BasicModule
{