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

Side by Side Diff: xfa/fxfa/app/xfa_fontmgr.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « testing/libfuzzer/pdf_hint_table_fuzzer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/xfa_fontmgr.h" 7 #include "xfa/fxfa/xfa_fontmgr.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 } 1832 }
1833 pFontSetDict = pFontSetDict->GetDictFor("Font"); 1833 pFontSetDict = pFontSetDict->GetDictFor("Font");
1834 if (!pFontSetDict) { 1834 if (!pFontSetDict) {
1835 return nullptr; 1835 return nullptr;
1836 } 1836 }
1837 CFX_ByteString name = strPsName; 1837 CFX_ByteString name = strPsName;
1838 name.Remove(' '); 1838 name.Remove(' ');
1839 CFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr(); 1839 CFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr();
1840 for (const auto& it : *pFontSetDict) { 1840 for (const auto& it : *pFontSetDict) {
1841 const CFX_ByteString& key = it.first; 1841 const CFX_ByteString& key = it.first;
1842 CPDF_Object* pObj = it.second; 1842 CPDF_Object* pObj = it.second.get();
1843 if (!PsNameMatchDRFontName(name.AsStringC(), bBold, bItalic, key, 1843 if (!PsNameMatchDRFontName(name.AsStringC(), bBold, bItalic, key,
1844 bStrictMatch)) { 1844 bStrictMatch)) {
1845 continue; 1845 continue;
1846 } 1846 }
1847 CPDF_Dictionary* pFontDict = ToDictionary(pObj->GetDirect()); 1847 CPDF_Dictionary* pFontDict = ToDictionary(pObj->GetDirect());
1848 if (!pFontDict || pFontDict->GetStringFor("Type") != "Font") { 1848 if (!pFontDict || pFontDict->GetStringFor("Type") != "Font") {
1849 return nullptr; 1849 return nullptr;
1850 } 1850 }
1851 CPDF_Font* pPDFFont = pDoc->LoadFont(pFontDict); 1851 CPDF_Font* pPDFFont = pDoc->LoadFont(pFontDict);
1852 if (!pPDFFont) { 1852 if (!pPDFFont) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc)); 2050 m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc));
2051 } 2051 }
2052 2052
2053 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { 2053 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) {
2054 m_PDFFontMgrMap.erase(hDoc); 2054 m_PDFFontMgrMap.erase(hDoc);
2055 } 2055 }
2056 2056
2057 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { 2057 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
2058 m_pDefFontMgr = std::move(pFontMgr); 2058 m_pDefFontMgr = std::move(pFontMgr);
2059 } 2059 }
OLDNEW
« no previous file with comments | « testing/libfuzzer/pdf_hint_table_fuzzer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698