summaryrefslogtreecommitdiff
path: root/core/fpdfapi/cpdf_modulemgr.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-05-18 15:51:20 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-19 01:39:40 +0000
commit76020fc9751e55661d1c01b6cd92dfcb1fd56e6a (patch)
tree59d5251b23f5acb78891bf2911a79f2c70812c1c /core/fpdfapi/cpdf_modulemgr.cpp
parent22644731e0e46eae1f50927376e557c7d64db1d5 (diff)
downloadpdfium-76020fc9751e55661d1c01b6cd92dfcb1fd56e6a.tar.xz
Move CCodec_ModuleMgr ownership to CPDF_ModuleMgr.
More straight forward than CFX_GEModule owning in and CPDF_ModuleMgr holding a pointer to it. Remove assumptions that the codec modules may return nullptr, and do IWYU. Change-Id: Iba7fc3c7ec223fd6d29a1ab74ed13d35689bc5d5 Reviewed-on: https://pdfium-review.googlesource.com/5654 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/cpdf_modulemgr.cpp')
-rw-r--r--core/fpdfapi/cpdf_modulemgr.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/core/fpdfapi/cpdf_modulemgr.cpp b/core/fpdfapi/cpdf_modulemgr.cpp
index 8e39bdd587..678997a8c9 100644
--- a/core/fpdfapi/cpdf_modulemgr.cpp
+++ b/core/fpdfapi/cpdf_modulemgr.cpp
@@ -45,10 +45,17 @@ void CPDF_ModuleMgr::Destroy() {
g_pDefaultMgr = nullptr;
}
-CPDF_ModuleMgr::CPDF_ModuleMgr() : m_pCodecModule(nullptr) {}
+CPDF_ModuleMgr::CPDF_ModuleMgr() {}
CPDF_ModuleMgr::~CPDF_ModuleMgr() {}
+void CPDF_ModuleMgr::Init() {
+ InitCodecModule();
+ InitPageModule();
+ LoadEmbeddedMaps();
+ LoadCodecModules();
+}
+
void CPDF_ModuleMgr::LoadEmbeddedMaps() {
LoadEmbeddedGB1CMaps();
LoadEmbeddedJapan1CMaps();
@@ -74,30 +81,34 @@ void CPDF_ModuleMgr::LoadCodecModules() {
#endif
}
+void CPDF_ModuleMgr::InitCodecModule() {
+ m_pCodecModule = pdfium::MakeUnique<CCodec_ModuleMgr>();
+}
+
void CPDF_ModuleMgr::InitPageModule() {
m_pPageModule = pdfium::MakeUnique<CPDF_PageModule>();
}
CCodec_FaxModule* CPDF_ModuleMgr::GetFaxModule() {
- return m_pCodecModule ? m_pCodecModule->GetFaxModule() : nullptr;
+ return m_pCodecModule->GetFaxModule();
}
CCodec_JpegModule* CPDF_ModuleMgr::GetJpegModule() {
- return m_pCodecModule ? m_pCodecModule->GetJpegModule() : nullptr;
+ return m_pCodecModule->GetJpegModule();
}
CCodec_JpxModule* CPDF_ModuleMgr::GetJpxModule() {
- return m_pCodecModule ? m_pCodecModule->GetJpxModule() : nullptr;
+ return m_pCodecModule->GetJpxModule();
}
CCodec_Jbig2Module* CPDF_ModuleMgr::GetJbig2Module() {
- return m_pCodecModule ? m_pCodecModule->GetJbig2Module() : nullptr;
+ return m_pCodecModule->GetJbig2Module();
}
CCodec_IccModule* CPDF_ModuleMgr::GetIccModule() {
- return m_pCodecModule ? m_pCodecModule->GetIccModule() : nullptr;
+ return m_pCodecModule->GetIccModule();
}
CCodec_FlateModule* CPDF_ModuleMgr::GetFlateModule() {
- return m_pCodecModule ? m_pCodecModule->GetFlateModule() : nullptr;
+ return m_pCodecModule->GetFlateModule();
}