31
32
33
34 #ifndef DEFINE_STATIC_LOCAL
35 #if COMPILER(GCC) && defined(__APPLE_CC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 1
36 #define DEFINE_STATIC_LOCAL(type, name, arguments) \
37 static type* name##Ptr = new type arguments; \
38 type& name = *name##Ptr
39 #else
40 #define DEFINE_STATIC_LOCAL(type, name, arguments) \
41 static type& name = *new type arguments
42 #endif
43 #endif
230 struct FontDataCacheKeyTraits : WTF::GenericHashTraits<FontPlatformData> {
231 static const bool emptyValueIsZero = true;
232 static const bool needsDestruction = true;
233 static const FontPlatformData& emptyValue()
234 {
235 DEFINE_STATIC_LOCAL(FontPlatformData, key, (0.f, false, false));
236 return key;
237 }
238 static void constructDeletedValue(FontPlatformData& slot)
239 {
240 new (&slot) FontPlatformData(HashTableDeletedValue);
241 }
242 static bool isDeletedValue(const FontPlatformData& value)
243 {
244 return value.isHashTableDeletedValue();
245 }
246 };
235 DEFINE_STATIC_LOCAL(FontPlatformData, key, (0.f, false, false));
static FontPlatformData& key = *new FontPlatformData (0.f, false, false);
289 void FontCache::releaseFontData(const SimpleFontData* fontData)
290 {
291 ASSERT(gFontDataCache);
292 ASSERT(!fontData->isCustomFont());
293
294 FontDataCache::iterator it = gFontDataCache->find(fontData->platformData());
295 ASSERT(it != gFontDataCache->end());
296
297 if (!--it->second.second) {
298 gInactiveFontData->add(fontData);
299 if (gInactiveFontData->size() > cMaxInactiveFontData)
300 purgeInactiveFontData(gInactiveFontData->size() - cTargetInactiveFontData);
301 }
302 }