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

MozReview-Commit-ID: 3zCPC9Pfikc

--HG--
extra : rebase_source : bfc5bd72b382b538448cb90ecc1208cea08216b8
This commit is contained in:
Cameron McCormack 2017-07-12 13:03:35 +08:00
Родитель 4f22849692
Коммит 5b5b4e145c
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() {