From b4d1b576bccb5ca6cebe29288af014bd0f512af1 Mon Sep 17 00:00:00 2001 From: weili Date: Wed, 10 Aug 2016 14:50:48 -0700 Subject: Use smart pointers for class owned pointers in xfa/fxfa Use smart pointers instead of raw pointer to make memory management easier for classes mainly under xfa/fxfa. Also change the return type of IFGAS_FontMgr::Create() to smart pointer type. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2227883002 --- xfa/fgas/font/fgas_stdfontmgr.h | 59 +++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 35 deletions(-) (limited to 'xfa/fgas/font/fgas_stdfontmgr.h') diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index 4de6971738..65f260c54c 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -28,7 +28,6 @@ class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { ~CFGAS_StdFontMgrImp() override; // IFGAS_FontMgr: - void Release() override; CFGAS_GEFont* GetDefFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, @@ -132,7 +131,6 @@ class CFX_FontSourceEnum_File { CFX_FontSourceEnum_File(); ~CFX_FontSourceEnum_File(); - void Release() { delete this; } FX_POSITION GetStartPosition(); IFX_FileAccess* GetNext(FX_POSITION& pos); @@ -150,39 +148,30 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { ~CFGAS_FontMgrImp() override; // IFGAS_FontMgr: - void Release() override; - CFGAS_GEFont* GetDefFontByCodePage( - uint16_t wCodePage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = nullptr) override; - CFGAS_GEFont* GetDefFontByCharset( - uint8_t nCharset, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = nullptr) override; - CFGAS_GEFont* GetDefFontByUnicode( - FX_WCHAR wUnicode, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = nullptr) override; - CFGAS_GEFont* GetDefFontByLanguage( - uint16_t wLanguage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = nullptr) override; - CFGAS_GEFont* GetFontByCodePage( - uint16_t wCodePage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = nullptr) override; - CFGAS_GEFont* GetFontByCharset( - uint8_t nCharset, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = nullptr) override; - CFGAS_GEFont* GetFontByUnicode( - FX_WCHAR wUnicode, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = nullptr) override; - CFGAS_GEFont* GetFontByLanguage( - uint16_t wLanguage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = nullptr) override; + CFGAS_GEFont* GetDefFontByCodePage(uint16_t wCodePage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) override; + CFGAS_GEFont* GetDefFontByCharset(uint8_t nCharset, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) override; + CFGAS_GEFont* GetDefFontByUnicode(FX_WCHAR wUnicode, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) override; + CFGAS_GEFont* GetDefFontByLanguage(uint16_t wLanguage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) override; + CFGAS_GEFont* GetFontByCodePage(uint16_t wCodePage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) override; + CFGAS_GEFont* GetFontByCharset(uint8_t nCharset, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) override; + CFGAS_GEFont* GetFontByUnicode(FX_WCHAR wUnicode, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) override; + CFGAS_GEFont* GetFontByLanguage(uint16_t wLanguage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) override; void ClearFontCache() override; void RemoveFont(CFGAS_GEFont* pFont) override; -- cgit v1.2.3