のねのBlog

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

generation

147 bool Font::operator==(const Font& other) const
    148 {
    149     // Our FontData don't have to be checked, since checking the font description will be fine.
    150     // FIXME: This does not work if the font was made with the FontPlatformData constructor.
    151     if (loadingCustomFonts() || other.loadingCustomFonts())
    152         return false;
    153 
    154     FontSelector* first = m_fontFallbackList ? m_fontFallbackList->fontSelector() : 0;
    155     FontSelector* second = other.m_fontFallbackList ? other.m_fontFallbackList->fontSelector() : 0;
    156 
    157     return first == second
    158         && m_fontDescription == other.m_fontDescription
    159         && m_letterSpacing == other.m_letterSpacing
    160         && m_wordSpacing == other.m_wordSpacing
    161         && (m_fontFallbackList ? m_fontFallbackList->fontSelectorVersion() : 0) == (other.m_fontFallbackList ? other.m_fontFallbackList->fontSelectorVersion() : 0)
    162         && (m_fontFallbackList ? m_fontFallbackList->generation() : 0) == (other.m_fontFallbackList ? other.m_fontFallbackList->generation() : 0);
    163 }
    164 
    522 static unsigned short gGeneration = 0;
    523 
    524 unsigned short FontCache::generation()
    525 {
    526     return gGeneration;
    527 }
     37 FontFallbackList::FontFallbackList()
     38     : m_pageZero(0)
     39     , m_cachedPrimarySimpleFontData(0)
     40     , m_fontSelector(0)
     41     , m_fontSelectorVersion(0)
     42     , m_familyIndex(0)
     43     , m_generation(fontCache()->generation()) <=====
     44     , m_pitch(UnknownPitch)
     45     , m_loadingCustomFonts(false)
     46 {
     47 }
     49 void FontFallbackList::invalidate(PassRefPtr<FontSelector> fontSelector)
     50 {
     51     releaseFontData();
     52     m_fontList.clear();
     53     m_pageZero = 0;
     54     m_pages.clear();
     55     m_cachedPrimarySimpleFontData = 0;
     56     m_familyIndex = 0;
     57     m_pitch = UnknownPitch;
     58     m_loadingCustomFonts = false;
     59     m_fontSelector = fontSelector;
     60     m_fontSelectorVersion = m_fontSelector ? m_fontSelector->version() : 0;
     61     m_generation = fontCache()->generation();  <=====
     62     m_widthCache.clear();
     63 }
    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 }