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

Unified Diff: xfa/fgas/font/fgas_gefont.cpp

Issue 2302213002: Revert of Fix leaked internal font (Closed)
Patch Set: Created 4 years, 3 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 | « xfa/fgas/font/fgas_gefont.h ('k') | xfa/fgas/font/fgas_stdfontmgr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fgas/font/fgas_gefont.cpp
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index 33d17489fa77012eadcf936ff87e88f6c8684419..1507fa4840a22c21e6ff185c22d390490ae77554 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -34,21 +34,10 @@
}
// static
-CFGAS_GEFont* CFGAS_GEFont::LoadFont(CFX_Font* pExternalFont,
+CFGAS_GEFont* CFGAS_GEFont::LoadFont(CFX_Font* pExtFont,
IFGAS_FontMgr* pFontMgr) {
CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr);
- if (!pFont->LoadFontInternal(pExternalFont)) {
- pFont->Release();
- return nullptr;
- }
- return pFont;
-}
-
-// static
-CFGAS_GEFont* CFGAS_GEFont::LoadFont(std::unique_ptr<CFX_Font> pInternalFont,
- IFGAS_FontMgr* pFontMgr) {
- CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr);
- if (!pFont->LoadFontInternal(std::move(pInternalFont))) {
+ if (!pFont->LoadFontInternal(pExtFont)) {
pFont->Release();
return nullptr;
}
@@ -90,7 +79,7 @@
m_pFont(nullptr),
m_pFontMgr(pFontMgr),
m_iRefCount(1),
- m_bExternalFont(false),
+ m_bExtFont(FALSE),
m_pProvider(nullptr) {
}
@@ -103,7 +92,7 @@
m_pFont(nullptr),
m_pFontMgr(src.m_pFontMgr),
m_iRefCount(1),
- m_bExternalFont(false),
+ m_bExtFont(FALSE),
m_pProvider(nullptr) {
ASSERT(src.m_pFont);
m_pFont = new CFX_Font;
@@ -128,7 +117,7 @@
m_SubstFonts.RemoveAll();
m_FontMapper.clear();
- if (!m_bExternalFont)
+ if (!m_bExtFont)
delete m_pFont;
}
@@ -220,22 +209,12 @@
}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) {
- if (m_pFont || !pExternalFont)
- return FALSE;
-
- m_pFont = pExternalFont;
- m_bExternalFont = true;
- return InitFont();
-}
-
-FX_BOOL CFGAS_GEFont::LoadFontInternal(
- std::unique_ptr<CFX_Font> pInternalFont) {
- if (m_pFont || !pInternalFont)
- return FALSE;
-
- m_pFont = pInternalFont.release();
- m_bExternalFont = false;
+FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pExtFont) {
+ if (m_pFont || !pExtFont) {
+ return FALSE;
+ }
+ m_pFont = pExtFont;
+ m_bExtFont = TRUE;
return InitFont();
}
« no previous file with comments | « xfa/fgas/font/fgas_gefont.h ('k') | xfa/fgas/font/fgas_stdfontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698