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

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

Issue 2616623005: Remove CFX_MapPtrToPtr in xfa/fgas, part 2 (Closed)
Patch Set: Created 3 years, 11 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/cfgas_fontmgr.h ('k') | xfa/fgas/font/cfgas_gefont.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fgas/font/cfgas_fontmgr.cpp
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 1849441a1681616691237ef978291d802997a60f..224e01cc80bff6a01bcbeafbfc93007645dfae51 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -575,13 +575,8 @@ CFGAS_FontMgr::CFGAS_FontMgr(CFX_FontSourceEnum_File* pFontEnum)
CFGAS_FontMgr::~CFGAS_FontMgr() {
for (int32_t i = 0; i < m_InstalledFonts.GetSize(); i++)
delete m_InstalledFonts[i];
- FX_POSITION pos = m_Hash2CandidateList.GetStartPosition();
- while (pos) {
- uint32_t dwHash;
- CFX_FontDescriptorInfos* pDescs;
- m_Hash2CandidateList.GetNextAssoc(pos, dwHash, pDescs);
- delete pDescs;
- }
+ for (auto& pair : m_Hash2CandidateList)
Tom Sepez 2017/01/05 21:31:46 NOTE: hang on, I'm going to make this unique_ptr.
+ delete pair.second;
m_Hash2Fonts.clear();
}
@@ -645,12 +640,12 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage(
if (!pFontArray->empty())
return (*pFontArray)[0];
- CFX_FontDescriptorInfos* sortedFonts = nullptr;
- if (!m_Hash2CandidateList.Lookup(dwHash, sortedFonts)) {
+ CFX_FontDescriptorInfos* sortedFonts = m_Hash2CandidateList[dwHash];
+ if (!sortedFonts) {
sortedFonts = new CFX_FontDescriptorInfos;
MatchFonts(*sortedFonts, wCodePage, dwFontStyles,
CFX_WideString(pszFontFamily), 0);
- m_Hash2CandidateList.SetAt(dwHash, sortedFonts);
+ m_Hash2CandidateList[dwHash] = sortedFonts;
}
if (sortedFonts->GetSize() == 0)
return nullptr;
@@ -688,12 +683,12 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode(
if (VerifyUnicode((*pFonts)[i], wUnicode))
return (*pFonts)[i];
}
- CFX_FontDescriptorInfos* sortedFonts = nullptr;
- if (!m_Hash2CandidateList.Lookup(dwHash, sortedFonts)) {
+ CFX_FontDescriptorInfos* sortedFonts = m_Hash2CandidateList[dwHash];
+ if (!sortedFonts) {
sortedFonts = new CFX_FontDescriptorInfos;
MatchFonts(*sortedFonts, wCodePage, dwFontStyles,
CFX_WideString(pszFontFamily), wUnicode);
- m_Hash2CandidateList.SetAt(dwHash, sortedFonts);
+ m_Hash2CandidateList[dwHash] = sortedFonts;
}
for (int32_t i = 0; i < sortedFonts->GetSize(); ++i) {
CFX_FontDescriptor* pDesc = sortedFonts->GetAt(i).pFont;
« no previous file with comments | « xfa/fgas/font/cfgas_fontmgr.h ('k') | xfa/fgas/font/cfgas_gefont.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698