Remove checks in fxge/ge now that FX_NEW can't return 0.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1081443004
diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp
index d044d72..755aad5 100644
--- a/core/src/fxge/ge/fx_ge.cpp
+++ b/core/src/fxge/ge/fx_ge.cpp
@@ -33,11 +33,8 @@
}
void CFX_GEModule::Create()
{
- g_pGEModule = FX_NEW CFX_GEModule;
- if (!g_pGEModule) {
- return;
- }
- g_pGEModule->m_pFontMgr = FX_NEW CFX_FontMgr;
+ g_pGEModule = new CFX_GEModule;
+ g_pGEModule->m_pFontMgr = new CFX_FontMgr;
g_pGEModule->InitPlatform();
g_pGEModule->SetTextGamma(2.2f);
}
@@ -55,7 +52,7 @@
CFX_FontCache* CFX_GEModule::GetFontCache()
{
if (m_pFontCache == NULL) {
- m_pFontCache = FX_NEW CFX_FontCache();
+ m_pFontCache = new CFX_FontCache();
}
return m_pFontCache;
}
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index ea59a48..104a239 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -68,10 +68,7 @@
{
m_bEmbedded = FALSE;
m_bVertical = bVertical;
- m_pSubstFont = FX_NEW CFX_SubstFont;
- if (!m_pSubstFont) {
- return FALSE;
- }
+ m_pSubstFont = new CFX_SubstFont;
m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont(face_name, bTrueType, flags, weight, italic_angle,
CharsetCP, m_pSubstFont);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -442,7 +439,5 @@
}
IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont)
{
- CFX_UnicodeEncoding* pEncoding = NULL;
- pEncoding = FX_NEW CFX_UnicodeEncoding(pFont);
- return pEncoding;
+ return new CFX_UnicodeEncoding(pFont);
}
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index 079c485..43b971f 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -61,10 +61,7 @@
}
CFX_FontMgr::CFX_FontMgr()
{
- m_pBuiltinMapper = FX_NEW CFX_FontMapper;
- if (!m_pBuiltinMapper) {
- return;
- }
+ m_pBuiltinMapper = new CFX_FontMapper;
m_pBuiltinMapper->m_pFontMgr = this;
m_pExtMapper = NULL;
m_FTLibrary = NULL;
@@ -136,10 +133,7 @@
FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name,
int weight, FX_BOOL bItalic, FX_LPBYTE pData, FX_DWORD size, int face_index)
{
- CTTFontDesc* pFontDesc = FX_NEW CTTFontDesc;
- if (!pFontDesc) {
- return NULL;
- }
+ CTTFontDesc* pFontDesc = new CTTFontDesc;
pFontDesc->m_Type = 1;
pFontDesc->m_SingleFace.m_pFace = NULL;
pFontDesc->m_SingleFace.m_bBold = weight;
@@ -337,10 +331,7 @@
{
CFX_ByteString key;
key.Format("%d:%d", ttc_size, checksum);
- CTTFontDesc* pFontDesc = FX_NEW CTTFontDesc;
- if (!pFontDesc) {
- return NULL;
- }
+ CTTFontDesc* pFontDesc = new CTTFontDesc;
pFontDesc->m_Type = 2;
pFontDesc->m_pFontData = pData;
for (int i = 0; i < 16; i ++) {
@@ -1416,10 +1407,7 @@
if (m_FontList.Lookup(facename, p)) {
return;
}
- CFontFaceInfo* pInfo = FX_NEW CFontFaceInfo;
- if (!pInfo) {
- return;
- }
+ CFontFaceInfo* pInfo = new CFontFaceInfo;
pInfo->m_FilePath = path;
pInfo->m_FaceName = facename;
pInfo->m_FontTables = tables;
diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp
index ad0a70a..b9cfc8e 100644
--- a/core/src/fxge/ge/fx_ge_linux.cpp
+++ b/core/src/fxge/ge/fx_ge_linux.cpp
@@ -208,10 +208,7 @@
}
IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault()
{
- CFX_LinuxFontInfo* pInfo = FX_NEW CFX_LinuxFontInfo;
- if (!pInfo) {
- return NULL;
- }
+ CFX_LinuxFontInfo* pInfo = new CFX_LinuxFontInfo;
if (!pInfo->ParseFontCfg()) {
pInfo->AddPath("/usr/share/fonts");
pInfo->AddPath("/usr/share/X11/fonts/Type1");
diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp
index 9da2246..ad57211 100644
--- a/core/src/fxge/ge/fx_ge_ps.cpp
+++ b/core/src/fxge/ge/fx_ge_ps.cpp
@@ -526,10 +526,7 @@
}
}
if (m_PSFontList.GetSize() == 0 || m_PSFontList[m_PSFontList.GetSize() - 1]->m_nGlyphs == 256) {
- CPSFont* pPSFont = FX_NEW CPSFont;
- if (!pPSFont) {
- return;
- }
+ CPSFont* pPSFont = new CPSFont;
pPSFont->m_nGlyphs = 0;
m_PSFontList.Add(pPSFont);
CFX_ByteTextBuf buf;
diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp
index 2e13c04..21eebb7 100644
--- a/core/src/fxge/ge/fx_ge_text.cpp
+++ b/core/src/fxge/ge/fx_ge_text.cpp
@@ -984,19 +984,8 @@
counted_face_cache->m_nCount++;
return counted_face_cache->m_Obj;
}
- CFX_FaceCache* face_cache = NULL;
- face_cache = FX_NEW CFX_FaceCache(bExternal ? NULL : (FXFT_Face)face);
- if (face_cache == NULL) {
- return NULL;
- }
- counted_face_cache = FX_NEW CFX_CountedFaceCache;
- if (!counted_face_cache) {
- if (face_cache) {
- delete face_cache;
- face_cache = NULL;
- }
- return NULL;
- }
+ CFX_FaceCache* face_cache = new CFX_FaceCache(bExternal ? NULL : (FXFT_Face)face);
+ counted_face_cache = new CFX_CountedFaceCache;
counted_face_cache->m_nCount = 2;
counted_face_cache->m_Obj = face_cache;
map.SetAt((FXFT_Face)face, counted_face_cache);
@@ -1081,10 +1070,7 @@
{
CFX_SizeGlyphCache* pSizeCache = NULL;
if (!m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) {
- pSizeCache = FX_NEW CFX_SizeGlyphCache;
- if (pSizeCache == NULL) {
- return NULL;
- }
+ pSizeCache = new CFX_SizeGlyphCache;
m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
}
CFX_GlyphBitmap* pGlyphBitmap = NULL;
@@ -1153,10 +1139,7 @@
} else {
pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias);
if (pGlyphBitmap) {
- pSizeCache = FX_NEW CFX_SizeGlyphCache;
- if (pSizeCache == NULL) {
- return NULL;
- }
+ pSizeCache = new CFX_SizeGlyphCache;
m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitmap);
return pGlyphBitmap;
@@ -1378,10 +1361,7 @@
return NULL;
}
int dib_width = bmwidth;
- CFX_GlyphBitmap* pGlyphBitmap = FX_NEW CFX_GlyphBitmap;
- if (!pGlyphBitmap) {
- return NULL;
- }
+ CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap;
pGlyphBitmap->m_Bitmap.Create(dib_width, bmheight,
anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1bppMask : FXDIB_8bppMask);
pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face);
@@ -1676,10 +1656,7 @@
if (params.m_PointCount == 0) {
return NULL;
}
- CFX_PathData* pPath = FX_NEW CFX_PathData;
- if (!pPath) {
- return NULL;
- }
+ CFX_PathData* pPath = new CFX_PathData;
pPath->SetPointCount(params.m_PointCount);
params.m_bCount = FALSE;
params.m_PointCount = 0;