のねのBlog

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

void 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 }
    126 typedef HashMap<FontPlatformDataCacheKey,
                        FontPlatformData*,
                        FontPlatformDataCacheKeyHash,
                        FontPlatformDataCacheKeyTraits> FontPlatformDataCache;
    127 
    128 static FontPlatformDataCache* gFontPlatformDataCache = 0;
    129 
     61 struct FontPlatformDataCacheKey {
     86     unsigned m_size;
     87     unsigned m_weight;
     88     AtomicString m_family;
     89     bool m_italic;
     90     bool m_printerFont;
     91     FontOrientation m_orientation;
     92     FontWidthVariant m_widthVariant;
     93 
     96 };
    110 struct FontPlatformDataCacheKeyHash {
    122 };
    124 struct FontPlatformDataCacheKeyTraits : WTF::SimpleClassHashTraits<FontPlatformDataCacheKey> { };
    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     }

delete it->value;でここを通る。

    157 FontPlatformData::~FontPlatformData()
    158 {
    159 }
   50         ALWAYS_INLINE ~RefPtr() { derefIfNotNull(m_ptr); }
     42     template<typename T> ALWAYS_INLINE void derefIfNotNull(T* ptr)
     43     {
     44         if (LIKELY(ptr != 0))
     45             ptr->deref();
     46     }