のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

fontCache()->invalidate()

    529 void FontCache::invalidate()
    530 {
    531     if (!gClients) {
    532         ASSERT(!gFontPlatformDataCache);
    533         return;
    534     }
    535 
    536     if (gFontPlatformDataCache) {
    537         deleteAllValues(*gFontPlatformDataCache); <=====
    538         delete gFontPlatformDataCache;
    539         gFontPlatformDataCache = new FontPlatformDataCache;
    540     }
    541 
    542     gGeneration++;
    543 
    544     Vector<RefPtr<FontSelector> > clients;
    545     size_t numClients = gClients->size();
    546     clients.reserveInitialCapacity(numClients);
    547     HashSet<FontSelector*>::iterator end = gClients->end();
    548     for (HashSet<FontSelector*>::iterator it = gClients->begin(); it != end; ++it)
    549         clients.append(*it);
    550 
    551     ASSERT(numClients == clients.size());
    552     for (size_t i = 0; i < numClients; ++i)
    553         clients[i]->fontCacheInvalidated();
    554 
    555     purgeInactiveFontData();
    556 }
    452     template<typename T, typename U, typename V, typename W, typename X>
    453     inline void deleteAllValues(const HashMap<T, U, V, W, X>& collection)
    454     {
    455         typedef typename HashMap<T, U, V, W, X>::const_iterator iterator;
    456         iterator end = collection.end();
    457         for (iterator it = collection.begin(); it != end; ++it)
    458             delete it->value;
    459     }
    126 typedef HashMap<
        FontPlatformDataCacheKey,
        FontPlatformData*,
        FontPlatformDataCacheKeyHash,
        FontPlatformDataCacheKeyTraits> FontPlatformDataCache;