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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 29 matching lines...) Expand all
40 #include "wtf/text/AtomicString.h" 40 #include "wtf/text/AtomicString.h"
41 41
42 42
43 namespace blink { 43 namespace blink {
44 44
45 FontFaceCache::FontFaceCache() 45 FontFaceCache::FontFaceCache()
46 : m_version(0) 46 : m_version(0)
47 { 47 {
48 } 48 }
49 49
50 void FontFaceCache::add(CSSFontSelector* cssFontSelector, const StyleRuleFontFac e* fontFaceRule, PassRefPtrWillBeRawPtr<FontFace> prpFontFace) 50 void FontFaceCache::add(CSSFontSelector* cssFontSelector, const StyleRuleFontFac e* fontFaceRule, RawPtr<FontFace> prpFontFace)
51 { 51 {
52 RefPtrWillBeRawPtr<FontFace> fontFace = prpFontFace; 52 RawPtr<FontFace> fontFace = prpFontFace;
53 if (!m_styleRuleToFontFace.add(fontFaceRule, fontFace).isNewEntry) 53 if (!m_styleRuleToFontFace.add(fontFaceRule, fontFace).isNewEntry)
54 return; 54 return;
55 addFontFace(cssFontSelector, fontFace, true); 55 addFontFace(cssFontSelector, fontFace, true);
56 } 56 }
57 57
58 void FontFaceCache::addFontFace(CSSFontSelector* cssFontSelector, PassRefPtrWill BeRawPtr<FontFace> prpFontFace, bool cssConnected) 58 void FontFaceCache::addFontFace(CSSFontSelector* cssFontSelector, RawPtr<FontFac e> prpFontFace, bool cssConnected)
59 { 59 {
60 RefPtrWillBeRawPtr<FontFace> fontFace = prpFontFace; 60 RawPtr<FontFace> fontFace = prpFontFace;
61 61
62 FamilyToTraitsMap::AddResult traitsResult = m_fontFaces.add(fontFace->family (), nullptr); 62 FamilyToTraitsMap::AddResult traitsResult = m_fontFaces.add(fontFace->family (), nullptr);
63 if (!traitsResult.storedValue->value) 63 if (!traitsResult.storedValue->value)
64 traitsResult.storedValue->value = adoptPtrWillBeNoop(new TraitsMap); 64 traitsResult.storedValue->value = (new TraitsMap);
65 65
66 TraitsMap::AddResult segmentedFontFaceResult = traitsResult.storedValue->val ue->add(fontFace->traits().bitfield(), nullptr); 66 TraitsMap::AddResult segmentedFontFaceResult = traitsResult.storedValue->val ue->add(fontFace->traits().bitfield(), nullptr);
67 if (!segmentedFontFaceResult.storedValue->value) 67 if (!segmentedFontFaceResult.storedValue->value)
68 segmentedFontFaceResult.storedValue->value = CSSSegmentedFontFace::creat e(cssFontSelector, fontFace->traits()); 68 segmentedFontFaceResult.storedValue->value = CSSSegmentedFontFace::creat e(cssFontSelector, fontFace->traits());
69 69
70 segmentedFontFaceResult.storedValue->value->addFontFace(fontFace, cssConnect ed); 70 segmentedFontFaceResult.storedValue->value->addFontFace(fontFace, cssConnect ed);
71 if (cssConnected) 71 if (cssConnected)
72 m_cssConnectedFontFaces.add(fontFace); 72 m_cssConnectedFontFaces.add(fontFace);
73 73
74 m_fonts.remove(fontFace->family()); 74 m_fonts.remove(fontFace->family());
(...skipping 12 matching lines...) Expand all
87 void FontFaceCache::removeFontFace(FontFace* fontFace, bool cssConnected) 87 void FontFaceCache::removeFontFace(FontFace* fontFace, bool cssConnected)
88 { 88 {
89 FamilyToTraitsMap::iterator fontFacesIter = m_fontFaces.find(fontFace->famil y()); 89 FamilyToTraitsMap::iterator fontFacesIter = m_fontFaces.find(fontFace->famil y());
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 = familyFontFaces->find(fontFace->tr aits().bitfield()); 94 TraitsMap::iterator familyFontFacesIter = familyFontFaces->find(fontFace->tr aits().bitfield());
95 if (familyFontFacesIter == familyFontFaces->end()) 95 if (familyFontFacesIter == familyFontFaces->end())
96 return; 96 return;
97 RefPtrWillBeRawPtr<CSSSegmentedFontFace> segmentedFontFace = familyFontFaces Iter->value; 97 RawPtr<CSSSegmentedFontFace> segmentedFontFace = familyFontFacesIter->value;
98 98
99 segmentedFontFace->removeFontFace(fontFace); 99 segmentedFontFace->removeFontFace(fontFace);
100 if (segmentedFontFace->isEmpty()) { 100 if (segmentedFontFace->isEmpty()) {
101 familyFontFaces->remove(familyFontFacesIter); 101 familyFontFaces->remove(familyFontFacesIter);
102 if (familyFontFaces->isEmpty()) 102 if (familyFontFaces->isEmpty())
103 m_fontFaces.remove(fontFacesIter); 103 m_fontFaces.remove(fontFacesIter);
104 } 104 }
105 m_fonts.remove(fontFace->family()); 105 m_fonts.remove(fontFace->family());
106 if (cssConnected) 106 if (cssConnected)
107 m_cssConnectedFontFaces.remove(fontFace); 107 m_cssConnectedFontFaces.remove(fontFace);
(...skipping 21 matching lines...) Expand all
129 } 129 }
130 130
131 CSSSegmentedFontFace* FontFaceCache::get(const FontDescription& fontDescription, const AtomicString& family) 131 CSSSegmentedFontFace* FontFaceCache::get(const FontDescription& fontDescription, const AtomicString& family)
132 { 132 {
133 TraitsMap* familyFontFaces = m_fontFaces.get(family); 133 TraitsMap* familyFontFaces = m_fontFaces.get(family);
134 if (!familyFontFaces || familyFontFaces->isEmpty()) 134 if (!familyFontFaces || familyFontFaces->isEmpty())
135 return nullptr; 135 return nullptr;
136 136
137 FamilyToTraitsMap::AddResult traitsResult = m_fonts.add(family, nullptr); 137 FamilyToTraitsMap::AddResult traitsResult = m_fonts.add(family, nullptr);
138 if (!traitsResult.storedValue->value) 138 if (!traitsResult.storedValue->value)
139 traitsResult.storedValue->value = adoptPtrWillBeNoop(new TraitsMap); 139 traitsResult.storedValue->value = (new TraitsMap);
140 140
141 FontTraits traits = fontDescription.traits(); 141 FontTraits traits = fontDescription.traits();
142 TraitsMap::AddResult faceResult = traitsResult.storedValue->value->add(trait s.bitfield(), nullptr); 142 TraitsMap::AddResult faceResult = traitsResult.storedValue->value->add(trait s.bitfield(), nullptr);
143 if (!faceResult.storedValue->value) { 143 if (!faceResult.storedValue->value) {
144 for (const auto& item : *familyFontFaces) { 144 for (const auto& item : *familyFontFaces) {
145 CSSSegmentedFontFace* candidate = item.value.get(); 145 CSSSegmentedFontFace* candidate = item.value.get();
146 FontStyleMatcher styleMatcher(traits); 146 FontStyleMatcher styleMatcher(traits);
147 if (!faceResult.storedValue->value || styleMatcher.isCandidateBetter (candidate, faceResult.storedValue->value.get())) 147 if (!faceResult.storedValue->value || styleMatcher.isCandidateBetter (candidate, faceResult.storedValue->value.get()))
148 faceResult.storedValue->value = candidate; 148 faceResult.storedValue->value = candidate;
149 } 149 }
150 } 150 }
151 return faceResult.storedValue->value.get(); 151 return faceResult.storedValue->value.get();
152 } 152 }
153 153
154 DEFINE_TRACE(FontFaceCache) 154 DEFINE_TRACE(FontFaceCache)
155 { 155 {
156 #if ENABLE(OILPAN) 156 #if ENABLE(OILPAN)
157 visitor->trace(m_fontFaces); 157 visitor->trace(m_fontFaces);
158 visitor->trace(m_fonts); 158 visitor->trace(m_fonts);
159 visitor->trace(m_styleRuleToFontFace); 159 visitor->trace(m_styleRuleToFontFace);
160 visitor->trace(m_cssConnectedFontFaces); 160 visitor->trace(m_cssConnectedFontFaces);
161 #endif 161 #endif
162 } 162 }
163 163
164 } // namespace blink 164 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698