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

Side by Side Diff: third_party/WebKit/Source/core/css/FontFaceCache.cpp

Issue 2759703002: Migrate WTF::HashMap::remove() to ::erase() (Closed)
Patch Set: rebase, fix one platform-specific reference Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 m_cssConnectedFontFaces.insert(fontFace); 73 m_cssConnectedFontFaces.insert(fontFace);
74 74
75 m_fonts.erase(fontFace->family()); 75 m_fonts.erase(fontFace->family());
76 incrementVersion(); 76 incrementVersion();
77 } 77 }
78 78
79 void FontFaceCache::remove(const StyleRuleFontFace* fontFaceRule) { 79 void FontFaceCache::remove(const StyleRuleFontFace* fontFaceRule) {
80 StyleRuleToFontFace::iterator it = m_styleRuleToFontFace.find(fontFaceRule); 80 StyleRuleToFontFace::iterator it = m_styleRuleToFontFace.find(fontFaceRule);
81 if (it != m_styleRuleToFontFace.end()) { 81 if (it != m_styleRuleToFontFace.end()) {
82 removeFontFace(it->value.get(), true); 82 removeFontFace(it->value.get(), true);
83 m_styleRuleToFontFace.remove(it); 83 m_styleRuleToFontFace.erase(it);
84 } 84 }
85 } 85 }
86 86
87 void FontFaceCache::removeFontFace(FontFace* fontFace, bool cssConnected) { 87 void FontFaceCache::removeFontFace(FontFace* fontFace, bool cssConnected) {
88 FamilyToTraitsMap::iterator fontFacesIter = 88 FamilyToTraitsMap::iterator fontFacesIter =
89 m_fontFaces.find(fontFace->family()); 89 m_fontFaces.find(fontFace->family());
90 if (fontFacesIter == m_fontFaces.end()) 90 if (fontFacesIter == m_fontFaces.end())
91 return; 91 return;
92 TraitsMap* familyFontFaces = fontFacesIter->value.get(); 92 TraitsMap* familyFontFaces = fontFacesIter->value.get();
93 93
94 TraitsMap::iterator familyFontFacesIter = 94 TraitsMap::iterator familyFontFacesIter =
95 familyFontFaces->find(fontFace->traits().bitfield()); 95 familyFontFaces->find(fontFace->traits().bitfield());
96 if (familyFontFacesIter == familyFontFaces->end()) 96 if (familyFontFacesIter == familyFontFaces->end())
97 return; 97 return;
98 CSSSegmentedFontFace* segmentedFontFace = familyFontFacesIter->value; 98 CSSSegmentedFontFace* segmentedFontFace = familyFontFacesIter->value;
99 99
100 segmentedFontFace->removeFontFace(fontFace); 100 segmentedFontFace->removeFontFace(fontFace);
101 if (segmentedFontFace->isEmpty()) { 101 if (segmentedFontFace->isEmpty()) {
102 familyFontFaces->remove(familyFontFacesIter); 102 familyFontFaces->erase(familyFontFacesIter);
103 if (familyFontFaces->isEmpty()) 103 if (familyFontFaces->isEmpty())
104 m_fontFaces.remove(fontFacesIter); 104 m_fontFaces.erase(fontFacesIter);
105 } 105 }
106 m_fonts.erase(fontFace->family()); 106 m_fonts.erase(fontFace->family());
107 if (cssConnected) 107 if (cssConnected)
108 m_cssConnectedFontFaces.erase(fontFace); 108 m_cssConnectedFontFaces.erase(fontFace);
109 109
110 incrementVersion(); 110 incrementVersion();
111 } 111 }
112 112
113 void FontFaceCache::clearCSSConnected() { 113 void FontFaceCache::clearCSSConnected() {
114 for (const auto& item : m_styleRuleToFontFace) 114 for (const auto& item : m_styleRuleToFontFace)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 DEFINE_TRACE(FontFaceCache) { 160 DEFINE_TRACE(FontFaceCache) {
161 visitor->trace(m_fontFaces); 161 visitor->trace(m_fontFaces);
162 visitor->trace(m_fonts); 162 visitor->trace(m_fonts);
163 visitor->trace(m_styleRuleToFontFace); 163 visitor->trace(m_styleRuleToFontFace);
164 visitor->trace(m_cssConnectedFontFaces); 164 visitor->trace(m_cssConnectedFontFaces);
165 } 165 }
166 166
167 } // namespace blink 167 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698