Bug 1376964 - Part 3: Add a generation counter to the user font cache. r=jfkthame

MozReview-Commit-ID: 3zCPC9Pfikc

--HG--
extra : rebase_source : 7186ed96da1b1a6710ef4f5b2f1443ddfe0ddc29
This commit is contained in:
Cameron McCormack 2017-07-12 16:35:45 +08:00
Родитель bb7733edcd
Коммит 439419baf9
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -1099,7 +1099,10 @@ gfxUserFontSet::GetFamily(const nsAString& aFamilyName)
///////////////////////////////////////////////////////////////////////////////
nsTHashtable<gfxUserFontSet::UserFontCache::Entry>*
gfxUserFontSet::UserFontCache::sUserFonts = nullptr;
gfxUserFontSet::UserFontCache::sUserFonts = nullptr;
uint32_t
gfxUserFontSet::UserFontCache::sGeneration = 0;
NS_IMPL_ISUPPORTS(gfxUserFontSet::UserFontCache::Flusher, nsIObserver)
@ -1233,6 +1236,8 @@ gfxUserFontSet::UserFontCache::CacheFont(gfxFontEntry* aFontEntry)
sUserFonts->PutEntry(Key(data->mURI, principal, aFontEntry,
data->mPrivate));
++sGeneration;
#ifdef DEBUG_USERFONT_CACHE
printf("userfontcache added fontentry: %p\n", aFontEntry);
Dump();

Просмотреть файл

@ -301,6 +301,10 @@ public:
gfxUserFontEntry* aUserFontEntry,
bool aPrivate);
// Generation number that is incremented whenever an entry is added to
// the cache. (Removals don't increment it.)
static uint32_t Generation() { return sGeneration; }
// Clear everything so that we don't leak URIs and Principals.
static void Shutdown();
@ -428,6 +432,8 @@ public:
};
static nsTHashtable<Entry>* sUserFonts;
static uint32_t sGeneration;
};
void SetLocalRulesUsed() {