diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:26 +0000 |
commit | fcea19dfd2c426bac0456da850e7c12258e4b9eb (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /gfx/thebes/gfxMacPlatformFontList.mm | |
parent | Adding upstream version 115.7.0esr. (diff) | |
download | firefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.tar.xz firefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/thebes/gfxMacPlatformFontList.mm')
-rw-r--r-- | gfx/thebes/gfxMacPlatformFontList.mm | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index b95c6fa1d1..8942a4247a 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -414,8 +414,8 @@ nsresult MacOSFontEntry::ReadCMAP(FontInfoData* aFontInfoData) { if (NS_SUCCEEDED(rv)) { gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList(); fontlist::FontList* sharedFontList = pfl->SharedFontList(); - if (!IsUserFont() && mShmemFace) { - mShmemFace->SetCharacterMap(sharedFontList, charmap); // async + if (!IsUserFont() && mShmemFace && mShmemFamily) { + mShmemFace->SetCharacterMap(sharedFontList, charmap, mShmemFamily); if (TrySetShmemCharacterMap()) { setCharMap = false; } @@ -552,6 +552,13 @@ gfxFontEntry* MacOSFontEntry::Clone() const { } CGFontRef MacOSFontEntry::GetFontRef() { + { + AutoReadLock lock(mLock); + if (mFontRefInitialized) { + return mFontRef; + } + } + AutoWriteLock lock(mLock); if (!mFontRefInitialized) { // Cache the CGFontRef, to be released by our destructor. mFontRef = CreateOrCopyFontRef(); @@ -616,7 +623,9 @@ class FontTableRec { } hb_blob_t* MacOSFontEntry::GetFontTable(uint32_t aTag) { + mLock.ReadLock(); AutoCFRelease<CGFontRef> fontRef = CreateOrCopyFontRef(); + mLock.ReadUnlock(); if (!fontRef) { return nullptr; } @@ -637,6 +646,16 @@ hb_blob_t* MacOSFontEntry::GetFontTable(uint32_t aTag) { } bool MacOSFontEntry::HasFontTable(uint32_t aTableTag) { + { + // If we've already initialized mAvailableTables, we can return without + // needing to take an exclusive lock. + AutoReadLock lock(mLock); + if (mAvailableTables.Count()) { + return mAvailableTables.GetEntry(aTableTag); + } + } + + AutoWriteLock lock(mLock); if (mAvailableTables.Count() == 0) { nsAutoreleasePool localPool; |