Bug 1890245 - Make gfxUserFontSet::mGeneration an atomic var, so we can read it safely without locking. r=gfx-reviewers,lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D207618
This commit is contained in:
Jonathan Kew 2024-04-17 20:45:42 +00:00
parent dca313655e
commit 50a66bfbd8
2 changed files with 4 additions and 4 deletions

View File

@ -469,7 +469,7 @@ void gfxUserFontEntry::DoLoadNextSrc(bool aIsContinue) {
if (fe) {
LOG(("userfonts (%p) [src %d] loaded local: (%s) for (%s) gen: %8.8x\n",
fontSet.get(), mCurrentSrcIndex, currSrc.mLocalName.get(),
mFamilyName.get(), uint32_t(fontSet->mGeneration)));
mFamilyName.get(), uint32_t(fontSet->GetGeneration())));
fe->mFeatureSettings.AppendElements(mFeatureSettings);
fe->mVariationSettings.AppendElements(mVariationSettings);
fe->mLanguageOverride = mLanguageOverride;
@ -816,7 +816,7 @@ bool gfxUserFontEntry::LoadPlatformFont(uint32_t aSrcIndex,
"(%p) gen: %8.8x compress: %d%%\n",
fontSet.get(), aSrcIndex,
mSrcList[aSrcIndex].mURI->GetSpecOrDefault().get(), mFamilyName.get(),
this, uint32_t(fontSet->mGeneration), fontCompressionRatio));
this, uint32_t(fontSet->GetGeneration()), fontCompressionRatio));
mPlatformFontEntry = fe;
SetLoadState(STATUS_LOADED);
if (NS_IsMainThread()) {

View File

@ -545,8 +545,8 @@ class gfxUserFontSet {
// font families defined by @font-face rules
nsRefPtrHashtable<nsCStringHashKey, gfxUserFontFamily> mFontFamilies;
uint64_t mGeneration; // bumped on any font load change
uint64_t mRebuildGeneration; // only bumped on rebuilds
mozilla::Atomic<uint64_t> mGeneration; // bumped on any font load change
uint64_t mRebuildGeneration; // only bumped on rebuilds
// true when local names have been looked up, false otherwise
bool mLocalRulesUsed;