From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- layout/style/FontFaceImpl.h | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'layout/style/FontFaceImpl.h') diff --git a/layout/style/FontFaceImpl.h b/layout/style/FontFaceImpl.h index 70c06609e9..7f1279a248 100644 --- a/layout/style/FontFaceImpl.h +++ b/layout/style/FontFaceImpl.h @@ -10,7 +10,7 @@ #include "mozilla/dom/FontFaceBinding.h" #include "mozilla/FontPropertyTypes.h" #include "mozilla/Maybe.h" -#include "mozilla/Mutex.h" +#include "mozilla/RWLock.h" #include "mozilla/ServoStyleConsts.h" #include "gfxUserFontSet.h" #include "nsCSSPropertyID.h" @@ -50,21 +50,15 @@ class FontFaceImpl final { Entry(gfxUserFontSet* aFontSet, nsTArray&& aFontFaceSrcList, gfxUserFontAttributes&& aAttr) : gfxUserFontEntry(std::move(aFontFaceSrcList), std::move(aAttr)), - mMutex("FontFaceImpl::Entry::mMutex"), mFontSet(aFontSet) {} void SetLoadState(UserFontLoadState aLoadState) override; void GetUserFontSets(nsTArray>& aResult) override; already_AddRefed GetUserFontSet() const override; - void CheckUserFontSet() { - MutexAutoLock lock(mMutex); - CheckUserFontSetLocked(); - } - #ifdef DEBUG bool HasUserFontSet(gfxUserFontSet* aFontSet) const { - MutexAutoLock lock(mMutex); + AutoReadLock lock(mLock); return mFontSet == aFontSet; } #endif @@ -73,19 +67,19 @@ class FontFaceImpl final { void RemoveFontFace(FontFaceImpl* aOwner); void FindFontFaceOwners(nsTHashSet& aOwners); - protected: - void CheckUserFontSetLocked() MOZ_REQUIRES(mMutex); + RWLock& Lock() const MOZ_RETURN_CAPABILITY(mLock) { return mLock; } - mutable Mutex mMutex; + protected: + void CheckUserFontSetLocked() MOZ_REQUIRES(mLock); // Font set which owns this entry; - gfxUserFontSet* MOZ_NON_OWNING_REF mFontSet MOZ_GUARDED_BY(mMutex); + gfxUserFontSet* MOZ_NON_OWNING_REF mFontSet MOZ_GUARDED_BY(mLock); // The FontFace objects that use this user font entry. We need to store // an array of these, not just a single pointer, since the user font // cache can return the same entry for different FontFaces that have // the same descriptor values and come from the same origin. - AutoTArray mFontFaces MOZ_GUARDED_BY(mMutex); + AutoTArray mFontFaces MOZ_GUARDED_BY(mLock); }; #ifdef DEBUG -- cgit v1.2.3