summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/PWL_FontMap.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-08-03 11:06:49 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-03 11:06:49 -0700
commit2d5b020304e8a9aa8afeb632c61daa7ece87e36d (patch)
tree4d7f04d4800577fa597b4ca1f1b4d31b87194ef0 /fpdfsdk/pdfwindow/PWL_FontMap.cpp
parentca27127240fbca2184f1c576b15b5212d5b314e6 (diff)
downloadpdfium-2d5b020304e8a9aa8afeb632c61daa7ece87e36d.tar.xz
Use smart pointers for class owned pointers
For all classes under /fpdfsdk, use smart pointer to replace raw pointer type for class owned member variables so that memory management will be easier. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2173253002
Diffstat (limited to 'fpdfsdk/pdfwindow/PWL_FontMap.cpp')
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index 9192afd5e8..96acb78ec2 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -35,14 +35,11 @@ const char* const g_sDEStandardFontName[] = {"Courier",
} // namespace
CPWL_FontMap::CPWL_FontMap(CFX_SystemHandler* pSystemHandler)
- : m_pPDFDoc(nullptr), m_pSystemHandler(pSystemHandler) {
+ : m_pSystemHandler(pSystemHandler) {
ASSERT(m_pSystemHandler);
}
CPWL_FontMap::~CPWL_FontMap() {
- delete m_pPDFDoc;
- m_pPDFDoc = nullptr;
-
Empty();
}
@@ -53,12 +50,12 @@ void CPWL_FontMap::SetSystemHandler(CFX_SystemHandler* pSystemHandler) {
CPDF_Document* CPWL_FontMap::GetDocument() {
if (!m_pPDFDoc) {
if (CPDF_ModuleMgr::Get()) {
- m_pPDFDoc = new CPDF_Document(nullptr);
+ m_pPDFDoc.reset(new CPDF_Document(nullptr));
m_pPDFDoc->CreateNewDoc();
}
}
- return m_pPDFDoc;
+ return m_pPDFDoc.get();
}
CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) {
@@ -413,7 +410,7 @@ int32_t CPWL_FontMap::GetNativeCharset() {
return nCharset;
}
-const CPWL_FontMap::CharsetFontMap CPWL_FontMap::defaultTTFMap[] = {
+const FPDF_CharsetFontMap CPWL_FontMap::defaultTTFMap[] = {
{ANSI_CHARSET, "Helvetica"}, {GB2312_CHARSET, "SimSun"},
{CHINESEBIG5_CHARSET, "MingLiU"}, {SHIFTJIS_CHARSET, "MS Gothic"},
{HANGUL_CHARSET, "Batang"}, {RUSSIAN_CHARSET, "Arial"},