Remove the ability to instantiate CPDF_PageModule Since CPDF_PageModule has no member variables, remove the ability to instantiate it. Change-Id: Iaae840e4ed4c4ec00ab9315a38c163c2c3f80c23 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/112433 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_pagemodule.cpp b/core/fpdfapi/page/cpdf_pagemodule.cpp index 82508a7..3ef0f8f 100644 --- a/core/fpdfapi/page/cpdf_pagemodule.cpp +++ b/core/fpdfapi/page/cpdf_pagemodule.cpp
@@ -8,40 +8,16 @@ #include "core/fpdfapi/font/cpdf_fontglobals.h" #include "core/fpdfapi/page/cpdf_colorspace.h" -#include "third_party/base/check.h" - -namespace { - -CPDF_PageModule* g_PageModule = nullptr; - -} // namespace // static void CPDF_PageModule::Create() { - DCHECK(!g_PageModule); - g_PageModule = new CPDF_PageModule(); -} - -// static -void CPDF_PageModule::Destroy() { - DCHECK(g_PageModule); - delete g_PageModule; - g_PageModule = nullptr; -} - -// static -CPDF_PageModule* CPDF_PageModule::GetInstance() { - DCHECK(g_PageModule); - return g_PageModule; -} - -CPDF_PageModule::CPDF_PageModule() { CPDF_ColorSpace::InitializeGlobals(); CPDF_FontGlobals::Create(); CPDF_FontGlobals::GetInstance()->LoadEmbeddedMaps(); } -CPDF_PageModule::~CPDF_PageModule() { +// static +void CPDF_PageModule::Destroy() { CPDF_FontGlobals::Destroy(); CPDF_ColorSpace::DestroyGlobals(); }
diff --git a/core/fpdfapi/page/cpdf_pagemodule.h b/core/fpdfapi/page/cpdf_pagemodule.h index feb1e97..bd55488 100644 --- a/core/fpdfapi/page/cpdf_pagemodule.h +++ b/core/fpdfapi/page/cpdf_pagemodule.h
@@ -7,16 +7,12 @@ #ifndef CORE_FPDFAPI_PAGE_CPDF_PAGEMODULE_H_ #define CORE_FPDFAPI_PAGE_CPDF_PAGEMODULE_H_ +// TODO(thestig): Replace with class with standalone functions without polluting +// the global namespace. class CPDF_PageModule { public: - // Per-process singleton managed by callers. static void Create(); static void Destroy(); - static CPDF_PageModule* GetInstance(); - - private: - CPDF_PageModule(); - ~CPDF_PageModule(); }; #endif // CORE_FPDFAPI_PAGE_CPDF_PAGEMODULE_H_