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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 if (it == end) { | 270 if (it == end) { |
271 // Removed everything | 271 // Removed everything |
272 gInactiveFontData->clear(); | 272 gInactiveFontData->clear(); |
273 } else { | 273 } else { |
274 for (int i = 0; i < count; ++i) | 274 for (int i = 0; i < count; ++i) |
275 gInactiveFontData->remove(gInactiveFontData->begin()); | 275 gInactiveFontData->remove(gInactiveFontData->begin()); |
276 } | 276 } |
277 | 277 |
278 Vector<FontPlatformDataCacheKey> keysToRemove; | 278 Vector<FontPlatformDataCacheKey> keysToRemove; |
279 keysToRemove.reserveCapacity(gFontPlatformDataCache->size()); | 279 keysToRemove.reserveInitialCapacity(gFontPlatformDataCache->size()); |
280 FontPlatformDataCache::iterator platformDataEnd = gFontPlatformDataCache->en
d(); | 280 FontPlatformDataCache::iterator platformDataEnd = gFontPlatformDataCache->en
d(); |
281 for (FontPlatformDataCache::iterator platformData = gFontPlatformDataCache->
begin(); platformData != platformDataEnd; ++platformData) { | 281 for (FontPlatformDataCache::iterator platformData = gFontPlatformDataCache->
begin(); platformData != platformDataEnd; ++platformData) { |
282 if (platformData->second && !gFontDataCache->contains(*platformData->sec
ond)) | 282 if (platformData->second && !gFontDataCache->contains(*platformData->sec
ond)) |
283 keysToRemove.append(platformData->first); | 283 keysToRemove.append(platformData->first); |
284 } | 284 } |
285 | 285 |
286 size_t keysToRemoveCount = keysToRemove.size(); | 286 size_t keysToRemoveCount = keysToRemove.size(); |
287 for (size_t i = 0; i < keysToRemoveCount; ++i) | 287 for (size_t i = 0; i < keysToRemoveCount; ++i) |
288 delete gFontPlatformDataCache->take(keysToRemove[i]); | 288 delete gFontPlatformDataCache->take(keysToRemove[i]); |
289 | 289 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if (gFontPlatformDataCache) { | 389 if (gFontPlatformDataCache) { |
390 deleteAllValues(*gFontPlatformDataCache); | 390 deleteAllValues(*gFontPlatformDataCache); |
391 delete gFontPlatformDataCache; | 391 delete gFontPlatformDataCache; |
392 gFontPlatformDataCache = new FontPlatformDataCache; | 392 gFontPlatformDataCache = new FontPlatformDataCache; |
393 } | 393 } |
394 | 394 |
395 gGeneration++; | 395 gGeneration++; |
396 | 396 |
397 Vector<RefPtr<FontSelector> > clients; | 397 Vector<RefPtr<FontSelector> > clients; |
398 size_t numClients = gClients->size(); | 398 size_t numClients = gClients->size(); |
399 clients.reserveCapacity(numClients); | 399 clients.reserveInitialCapacity(numClients); |
400 HashSet<FontSelector*>::iterator end = gClients->end(); | 400 HashSet<FontSelector*>::iterator end = gClients->end(); |
401 for (HashSet<FontSelector*>::iterator it = gClients->begin(); it != end; ++i
t) | 401 for (HashSet<FontSelector*>::iterator it = gClients->begin(); it != end; ++i
t) |
402 clients.append(*it); | 402 clients.append(*it); |
403 | 403 |
404 ASSERT(numClients == clients.size()); | 404 ASSERT(numClients == clients.size()); |
405 for (size_t i = 0; i < numClients; ++i) | 405 for (size_t i = 0; i < numClients; ++i) |
406 clients[i]->fontCacheInvalidated(); | 406 clients[i]->fontCacheInvalidated(); |
407 | 407 |
408 purgeInactiveFontData(); | 408 purgeInactiveFontData(); |
409 } | 409 } |
410 | 410 |
411 } // namespace WebCore | 411 } // namespace WebCore |
412 | 412 |
413 | 413 |
OLD | NEW |