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

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

Issue 1973153004: Fix FontCacheKey-keyed HashMap usage in core/css (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +comment Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSegmentedFontFace.h ('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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 PassRefPtr<FontData> CSSSegmentedFontFace::getFontData(const FontDescription& fo ntDescription) 102 PassRefPtr<FontData> CSSSegmentedFontFace::getFontData(const FontDescription& fo ntDescription)
103 { 103 {
104 if (!isValid()) 104 if (!isValid())
105 return nullptr; 105 return nullptr;
106 106
107 FontTraits desiredTraits = fontDescription.traits(); 107 FontTraits desiredTraits = fontDescription.traits();
108 FontCacheKey key = fontDescription.cacheKey(FontFaceCreationParams(), desire dTraits); 108 FontCacheKey key = fontDescription.cacheKey(FontFaceCreationParams(), desire dTraits);
109 109
110 RefPtr<SegmentedFontData>& fontData = m_fontDataTable.add(key.hash(), nullpt r).storedValue->value; 110 RefPtr<SegmentedFontData>& fontData = m_fontDataTable.add(key, nullptr).stor edValue->value;
111 if (fontData && fontData->numFaces()) 111 if (fontData && fontData->numFaces())
112 return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has. 112 return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has.
113 113
114 if (!fontData) 114 if (!fontData)
115 fontData = SegmentedFontData::create(); 115 fontData = SegmentedFontData::create();
116 116
117 FontDescription requestedFontDescription(fontDescription); 117 FontDescription requestedFontDescription(fontDescription);
118 requestedFontDescription.setTraits(m_traits); 118 requestedFontDescription.setTraits(m_traits);
119 requestedFontDescription.setSyntheticBold(m_traits.weight() < FontWeight600 && desiredTraits.weight() >= FontWeight600); 119 requestedFontDescription.setSyntheticBold(m_traits.weight() < FontWeight600 && desiredTraits.weight() >= FontWeight600);
120 requestedFontDescription.setSyntheticItalic(m_traits.style() == FontStyleNor mal && desiredTraits.style() == FontStyleItalic); 120 requestedFontDescription.setSyntheticItalic(m_traits.style() == FontStyleNor mal && desiredTraits.style() == FontStyleItalic);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 172 }
173 } 173 }
174 174
175 DEFINE_TRACE(CSSSegmentedFontFace) 175 DEFINE_TRACE(CSSSegmentedFontFace)
176 { 176 {
177 visitor->trace(m_fontSelector); 177 visitor->trace(m_fontSelector);
178 visitor->trace(m_fontFaces); 178 visitor->trace(m_fontFaces);
179 } 179 }
180 180
181 } // namespace blink 181 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSegmentedFontFace.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698