From 50a66bfbd81a466cb960203c0d159866fcfdf9af Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 17 Apr 2024 20:45:42 +0000 Subject: [PATCH] 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 --- gfx/thebes/gfxUserFontSet.cpp | 4 ++-- gfx/thebes/gfxUserFontSet.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gfx/thebes/gfxUserFontSet.cpp b/gfx/thebes/gfxUserFontSet.cpp index 5b0b33533909..f1cea3d914a5 100644 --- a/gfx/thebes/gfxUserFontSet.cpp +++ b/gfx/thebes/gfxUserFontSet.cpp @@ -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()) { diff --git a/gfx/thebes/gfxUserFontSet.h b/gfx/thebes/gfxUserFontSet.h index 58cd2a077fd9..4dadea73b01a 100644 --- a/gfx/thebes/gfxUserFontSet.h +++ b/gfx/thebes/gfxUserFontSet.h @@ -545,8 +545,8 @@ class gfxUserFontSet { // font families defined by @font-face rules nsRefPtrHashtable mFontFamilies; - uint64_t mGeneration; // bumped on any font load change - uint64_t mRebuildGeneration; // only bumped on rebuilds + mozilla::Atomic 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;