summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-07-20 10:35:31 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-20 10:35:31 -0700
commit47228aceb86744f858ab8bfa98f3f8b62054dfae (patch)
treed5d8abbc5eaeb23b291cf604bf33c77cf648b0bb /core/fpdfapi
parent31f8740fe51ceca8e973a2efe40d4d440d7a5cb7 (diff)
downloadpdfium-47228aceb86744f858ab8bfa98f3f8b62054dfae.tar.xz
Clean up singleton implementation
Move the singleton instances into their namespaces, and use get()/getInstance() for uniform accesses. Review-Url: https://codereview.chromium.org/2154843002
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/cpdf_modulemgr.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/core/fpdfapi/cpdf_modulemgr.cpp b/core/fpdfapi/cpdf_modulemgr.cpp
index fe5368d3f7..454ffcd465 100644
--- a/core/fpdfapi/cpdf_modulemgr.cpp
+++ b/core/fpdfapi/cpdf_modulemgr.cpp
@@ -11,25 +11,21 @@
namespace {
-CPDF_ModuleMgr* g_FPDFAPI_pDefaultMgr = nullptr;
+CPDF_ModuleMgr* g_pDefaultMgr = nullptr;
} // namespace
// 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 (!g_pDefaultMgr)
+ g_pDefaultMgr = new CPDF_ModuleMgr;
+ return g_pDefaultMgr;
}
// static
void CPDF_ModuleMgr::Destroy() {
- delete g_FPDFAPI_pDefaultMgr;
- g_FPDFAPI_pDefaultMgr = nullptr;
+ delete g_pDefaultMgr;
+ g_pDefaultMgr = nullptr;
}
CPDF_ModuleMgr::CPDF_ModuleMgr() : m_pCodecModule(nullptr) {}