Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2389)

Unified Diff: core/fpdfapi/cpdf_modulemgr.cpp

Issue 2154843002: Clean up singleton implementation (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fpdfapi/include/cpdf_modulemgr.h » ('j') | core/fpdfapi/include/cpdf_modulemgr.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/cpdf_modulemgr.cpp
diff --git a/core/fpdfapi/cpdf_modulemgr.cpp b/core/fpdfapi/cpdf_modulemgr.cpp
index fe5368d3f7ca82ce8605324f5ed0107969224f24..e26bb91cafeb934292e6de9690f768fed53da7b4 100644
--- a/core/fpdfapi/cpdf_modulemgr.cpp
+++ b/core/fpdfapi/cpdf_modulemgr.cpp
@@ -9,27 +9,19 @@
#include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h"
#include "core/fxcodec/include/fx_codec.h"
-namespace {
-
-CPDF_ModuleMgr* g_FPDFAPI_pDefaultMgr = nullptr;
-
-} // namespace
+CPDF_ModuleMgr* CPDF_ModuleMgr::m_pDefaultMgr = nullptr;
// static
CPDF_ModuleMgr* CPDF_ModuleMgr::Get() {
- return g_FPDFAPI_pDefaultMgr;
-}
-
-// static
-void CPDF_ModuleMgr::Create() {
- ASSERT(!g_FPDFAPI_pDefaultMgr);
- g_FPDFAPI_pDefaultMgr = new CPDF_ModuleMgr;
+ if (!m_pDefaultMgr)
+ m_pDefaultMgr = new CPDF_ModuleMgr;
+ return m_pDefaultMgr;
}
// static
void CPDF_ModuleMgr::Destroy() {
- delete g_FPDFAPI_pDefaultMgr;
- g_FPDFAPI_pDefaultMgr = nullptr;
+ delete m_pDefaultMgr;
+ m_pDefaultMgr = nullptr;
}
CPDF_ModuleMgr::CPDF_ModuleMgr() : m_pCodecModule(nullptr) {}
« no previous file with comments | « no previous file | core/fpdfapi/include/cpdf_modulemgr.h » ('j') | core/fpdfapi/include/cpdf_modulemgr.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698