kumarashishg | 826308d | 2023-06-23 13:21:22 +0000 | [diff] [blame] | 1 | // Copyright 2020 The PDFium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "xfa/fgas/font/cfgas_gemodule.h" |
| 6 | |
| 7 | #include "third_party/base/check.h" |
| 8 | #include "xfa/fgas/font/cfgas_fontmgr.h" |
| 9 | |
| 10 | namespace { |
| 11 | |
| 12 | CFGAS_GEModule* g_module = nullptr; |
| 13 | |
| 14 | } // namespace |
| 15 | |
| 16 | // static |
| 17 | void CFGAS_GEModule::Create() { |
| 18 | DCHECK(!g_module); |
| 19 | g_module = new CFGAS_GEModule(); |
| 20 | g_module->GetFontMgr()->EnumFonts(); |
| 21 | } |
| 22 | |
| 23 | // static |
| 24 | void CFGAS_GEModule::Destroy() { |
| 25 | DCHECK(g_module); |
| 26 | delete g_module; |
| 27 | g_module = nullptr; |
| 28 | } |
| 29 | |
| 30 | // static |
| 31 | CFGAS_GEModule* CFGAS_GEModule::Get() { |
| 32 | DCHECK(g_module); |
| 33 | return g_module; |
| 34 | } |
| 35 | |
| 36 | CFGAS_GEModule::CFGAS_GEModule() |
| 37 | : font_mgr_(std::make_unique<CFGAS_FontMgr>()) {} |
| 38 | |
| 39 | CFGAS_GEModule::~CFGAS_GEModule() = default; |