OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
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 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return getLastResortFallbackFont(fontDescription, DoNotRetain).leakRef(); | 348 return getLastResortFallbackFont(fontDescription, DoNotRetain).leakRef(); |
349 } | 349 } |
350 | 350 |
351 void FontCache::releaseFontData(const SimpleFontData* fontData) | 351 void FontCache::releaseFontData(const SimpleFontData* fontData) |
352 { | 352 { |
353 ASSERT(gFontDataCache); | 353 ASSERT(gFontDataCache); |
354 ASSERT(!fontData->isCustomFont()); | 354 ASSERT(!fontData->isCustomFont()); |
355 | 355 |
356 FontDataCache::iterator it = gFontDataCache->find(fontData->platformData()); | 356 FontDataCache::iterator it = gFontDataCache->find(fontData->platformData()); |
357 ASSERT(it != gFontDataCache->end()); | 357 ASSERT(it != gFontDataCache->end()); |
| 358 if (it == gFontDataCache->end()) |
| 359 return; |
358 | 360 |
359 ASSERT(it->value.second); | 361 ASSERT(it->value.second); |
360 if (!--it->value.second) | 362 if (!--it->value.second) |
361 gInactiveFontData->add(it->value.first); | 363 gInactiveFontData->add(it->value.first); |
362 } | 364 } |
363 | 365 |
364 void FontCache::purgeInactiveFontDataIfNeeded() | 366 void FontCache::purgeInactiveFontDataIfNeeded() |
365 { | 367 { |
366 if (gInactiveFontData && !m_purgePreventCount && gInactiveFontData->size() >
cMaxInactiveFontData) | 368 if (gInactiveFontData && !m_purgePreventCount && gInactiveFontData->size() >
cMaxInactiveFontData) |
367 purgeInactiveFontData(gInactiveFontData->size() - cTargetInactiveFontDat
a); | 369 purgeInactiveFontData(gInactiveFontData->size() - cTargetInactiveFontDat
a); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 clients.append(*it); | 552 clients.append(*it); |
551 | 553 |
552 ASSERT(numClients == clients.size()); | 554 ASSERT(numClients == clients.size()); |
553 for (size_t i = 0; i < numClients; ++i) | 555 for (size_t i = 0; i < numClients; ++i) |
554 clients[i]->fontCacheInvalidated(); | 556 clients[i]->fontCacheInvalidated(); |
555 | 557 |
556 purgeInactiveFontData(); | 558 purgeInactiveFontData(); |
557 } | 559 } |
558 | 560 |
559 } // namespace WebCore | 561 } // namespace WebCore |
OLD | NEW |