| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 if (!gFontDataCache || !gFontDataCache->purge(PurgeSeverity)) | 305 if (!gFontDataCache || !gFontDataCache->purge(PurgeSeverity)) |
| 306 return; | 306 return; |
| 307 | 307 |
| 308 purgePlatformFontDataCache(); | 308 purgePlatformFontDataCache(); |
| 309 purgeFontVerticalDataCache(); | 309 purgeFontVerticalDataCache(); |
| 310 purgeFallbackListShaperCache(); | 310 purgeFallbackListShaperCache(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 static bool invalidateFontCache = false; | 313 static bool invalidateFontCache = false; |
| 314 | 314 |
| 315 WillBeHeapHashSet<RawPtrWillBeWeakMember<FontCacheClient>>& fontCacheClients() | 315 HeapHashSet<WeakMember<FontCacheClient>>& fontCacheClients() |
| 316 { | 316 { |
| 317 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WillBeHeapHashSet<RawPtrWillBeWea
kMember<FontCacheClient>>>, clients, (adoptPtrWillBeNoop(new WillBeHeapHashSet<R
awPtrWillBeWeakMember<FontCacheClient>>()))); | 317 DEFINE_STATIC_LOCAL(Persistent<HeapHashSet<WeakMember<FontCacheClient>>>, cl
ients, ((new HeapHashSet<WeakMember<FontCacheClient>>()))); |
| 318 invalidateFontCache = true; | 318 invalidateFontCache = true; |
| 319 return *clients; | 319 return *clients; |
| 320 } | 320 } |
| 321 | 321 |
| 322 void FontCache::addClient(FontCacheClient* client) | 322 void FontCache::addClient(FontCacheClient* client) |
| 323 { | 323 { |
| 324 ASSERT(!fontCacheClients().contains(client)); | 324 ASSERT(!fontCacheClients().contains(client)); |
| 325 fontCacheClients().add(client); | 325 fontCacheClients().add(client); |
| 326 } | 326 } |
| 327 | 327 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 347 return; | 347 return; |
| 348 } | 348 } |
| 349 | 349 |
| 350 if (gFontPlatformDataCache) { | 350 if (gFontPlatformDataCache) { |
| 351 delete gFontPlatformDataCache; | 351 delete gFontPlatformDataCache; |
| 352 gFontPlatformDataCache = new FontPlatformDataCache; | 352 gFontPlatformDataCache = new FontPlatformDataCache; |
| 353 } | 353 } |
| 354 | 354 |
| 355 gGeneration++; | 355 gGeneration++; |
| 356 | 356 |
| 357 WillBeHeapVector<RefPtrWillBeMember<FontCacheClient>> clients; | 357 HeapVector<Member<FontCacheClient>> clients; |
| 358 size_t numClients = fontCacheClients().size(); | 358 size_t numClients = fontCacheClients().size(); |
| 359 clients.reserveInitialCapacity(numClients); | 359 clients.reserveInitialCapacity(numClients); |
| 360 WillBeHeapHashSet<RawPtrWillBeWeakMember<FontCacheClient>>::iterator end = f
ontCacheClients().end(); | 360 HeapHashSet<WeakMember<FontCacheClient>>::iterator end = fontCacheClients().
end(); |
| 361 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<FontCacheClient>>::iterator it
= fontCacheClients().begin(); it != end; ++it) | 361 for (HeapHashSet<WeakMember<FontCacheClient>>::iterator it = fontCacheClient
s().begin(); it != end; ++it) |
| 362 clients.append(*it); | 362 clients.append(*it); |
| 363 | 363 |
| 364 ASSERT(numClients == clients.size()); | 364 ASSERT(numClients == clients.size()); |
| 365 for (size_t i = 0; i < numClients; ++i) | 365 for (size_t i = 0; i < numClients; ++i) |
| 366 clients[i]->fontCacheInvalidated(); | 366 clients[i]->fontCacheInvalidated(); |
| 367 | 367 |
| 368 purge(ForcePurge); | 368 purge(ForcePurge); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void FontCache::dumpFontPlatformDataCache(WebProcessMemoryDump* memoryDump) | 371 void FontCache::dumpFontPlatformDataCache(WebProcessMemoryDump* memoryDump) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 394 iter != gFallbackListShaperCache->end(); | 394 iter != gFallbackListShaperCache->end(); |
| 395 ++iter) { | 395 ++iter) { |
| 396 shapeResultCacheSize += iter->value->byteSize(); | 396 shapeResultCacheSize += iter->value->byteSize(); |
| 397 } | 397 } |
| 398 dump->addScalar("size", "bytes", shapeResultCacheSize); | 398 dump->addScalar("size", "bytes", shapeResultCacheSize); |
| 399 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate
dObjectPoolName)); | 399 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate
dObjectPoolName)); |
| 400 } | 400 } |
| 401 | 401 |
| 402 | 402 |
| 403 } // namespace blink | 403 } // namespace blink |
| OLD | NEW |