Backed out 2 changesets (bug 1803406) for causing OSX failures/leakchecks CLOSED TREE

Backed out changeset eaf61f658327 (bug 1803406)
Backed out changeset 48b489f34de2 (bug 1803406)
This commit is contained in:
Sandor Molnar 2023-11-08 07:23:43 +02:00
Родитель 3f48748109
Коммит 273b2e8820
4 изменённых файлов: 13 добавлений и 41 удалений

Просмотреть файл

@ -34,10 +34,7 @@ class gfxMacPlatformFontList final : public CoreTextFontList {
friend class gfxPlatformMac;
gfxMacPlatformFontList();
virtual ~gfxMacPlatformFontList() {
// Don't leak the name that was cached during startup.
sSystemFontName.~nsCString();
}
virtual ~gfxMacPlatformFontList() = default;
// Special-case font faces treated as font families (set via prefs)
void InitSingleFaceList() MOZ_REQUIRES(mLock) override;
@ -46,11 +43,6 @@ class gfxMacPlatformFontList final : public CoreTextFontList {
// initialize system fonts
void InitSystemFontNames() override MOZ_REQUIRES(mLock);
// Static, so that the startup RegisterFonts thread can call it before the
// platform font list is created, to initialize & cache the name.
static const nsCString& GetSystemFontName();
static nsCString sSystemFontName;
nsTArray<nsCString> mSingleFaceFonts;
};

Просмотреть файл

@ -433,26 +433,18 @@ static NSString* GetRealFamilyName(NSFont* aFont) {
return [familyName autorelease];
}
/* static */
const nsCString& gfxMacPlatformFontList::GetSystemFontName() {
if (sSystemFontName.IsEmpty()) {
NSString* name = GetRealFamilyName([NSFont systemFontOfSize:0.0]);
nsAutoString familyName;
nsCocoaUtils::GetStringForNSString(name, familyName);
CopyUTF16toUTF8(familyName, sSystemFontName);
}
return sSystemFontName;
}
nsCString gfxMacPlatformFontList::sSystemFontName;
void gfxMacPlatformFontList::InitSystemFontNames() {
mSystemFontFamilyName = GetSystemFontName();
// text font family
NSFont* sys = [NSFont systemFontOfSize:0.0];
NSString* textFamilyName = GetRealFamilyName(sys);
nsAutoString familyName;
nsCocoaUtils::GetStringForNSString(textFamilyName, familyName);
CopyUTF16toUTF8(familyName, mSystemFontFamilyName);
// We store an in-process gfxFontFamily for the system font even if using the
// shared fontlist to manage "normal" fonts, because the hidden system fonts
// may be excluded from the font list altogether. This family will be
// populated based on the given NSFont.
NSFont* sys = [NSFont systemFontOfSize:0.0];
RefPtr<gfxFontFamily> fam = new gfxMacFontFamily(mSystemFontFamilyName, sys);
if (fam) {
nsAutoCString key;

Просмотреть файл

@ -64,8 +64,6 @@ void gfxPlatformMac::FontRegistrationCallback(void* aUnused) {
for (const auto& dir : kLangFontsDirs) {
gfxMacPlatformFontList::ActivateFontsFromDir(dir);
}
gfxMacPlatformFontList::GetSystemFontName();
}
PRThread* gfxPlatformMac::sFontRegistrationThread = nullptr;
@ -76,21 +74,12 @@ PRThread* gfxPlatformMac::sFontRegistrationThread = nullptr;
our font list. */
/* static */
void gfxPlatformMac::RegisterSupplementalFonts() {
switch (XRE_GetProcessType()) {
case GeckoProcessType_Default:
case GeckoProcessType_Content:
// TODO: figure out if this matters to any other processes (e.g. GPU?)
//
// We activate the fonts on a separate thread, to minimize the startup-
// time cost.
sFontRegistrationThread = PR_CreateThread(
PR_USER_THREAD, FontRegistrationCallback, nullptr, PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
break;
default:
// Assume other process types don't actually need the full font list.
break;
// On Catalina+, it appears to be sufficient to activate fonts in the parent
// process; they are then also usable in child processes.
if (XRE_IsParentProcess()) {
sFontRegistrationThread = PR_CreateThread(
PR_USER_THREAD, FontRegistrationCallback, nullptr, PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
}
}

Просмотреть файл

@ -93,7 +93,6 @@ class gfxPlatformMac : public gfxPlatform {
static void FontRegistrationCallback(void* aUnused);
nsCString mSystemFontName;
uint32_t mFontAntiAliasingThreshold;
static PRThread* sFontRegistrationThread;