From 76020fc9751e55661d1c01b6cd92dfcb1fd56e6a Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 18 May 2017 15:51:20 -0700 Subject: 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 Reviewed-by: dsinclair --- fpdfsdk/fpdfdoc_unittest.cpp | 5 +---- fpdfsdk/fpdfeditimg_unittest.cpp | 5 +---- fpdfsdk/fpdfview.cpp | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdfdoc_unittest.cpp b/fpdfsdk/fpdfdoc_unittest.cpp index c63d6c2e77..449121d351 100644 --- a/fpdfsdk/fpdfdoc_unittest.cpp +++ b/fpdfsdk/fpdfdoc_unittest.cpp @@ -58,10 +58,7 @@ class PDFDocTest : public testing::Test { }; void SetUp() override { - // We don't need page module or render module, but - // initialize them to keep the code sane. - CPDF_ModuleMgr* module_mgr = CPDF_ModuleMgr::Get(); - module_mgr->InitPageModule(); + CPDF_ModuleMgr::Get()->Init(); m_pDoc = pdfium::MakeUnique(); m_pIndirectObjs = m_pDoc->GetHolder(); diff --git a/fpdfsdk/fpdfeditimg_unittest.cpp b/fpdfsdk/fpdfeditimg_unittest.cpp index da6930caed..0ff3db8e2d 100644 --- a/fpdfsdk/fpdfeditimg_unittest.cpp +++ b/fpdfsdk/fpdfeditimg_unittest.cpp @@ -8,10 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" class PDFEditTest : public testing::Test { - void SetUp() override { - CPDF_ModuleMgr* module_mgr = CPDF_ModuleMgr::Get(); - module_mgr->InitPageModule(); - } + void SetUp() override { CPDF_ModuleMgr::Get()->Init(); } void TearDown() override { CPDF_ModuleMgr::Destroy(); } }; diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 2bf6dfca74..76913cee4f 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -360,10 +360,7 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* cfg) { pModule->Init(cfg ? cfg->m_pUserFontPaths : nullptr); CPDF_ModuleMgr* pModuleMgr = CPDF_ModuleMgr::Get(); - pModuleMgr->SetCodecModule(pModule->GetCodecModule()); - pModuleMgr->InitPageModule(); - pModuleMgr->LoadEmbeddedMaps(); - pModuleMgr->LoadCodecModules(); + pModuleMgr->Init(); #ifdef PDF_ENABLE_XFA FXJSE_Initialize(); -- cgit v1.2.3