зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1678116 - On recent macOS systems, avoid expensive initialization of the system font family in content processes. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D97702
This commit is contained in:
Родитель
27dea98f3f
Коммит
1839bfca69
|
@ -924,6 +924,8 @@ nsresult gfxMacPlatformFontList::InitFontListForPlatform() {
|
||||||
|
|
||||||
Telemetry::AutoTimer<Telemetry::MAC_INITFONTLIST_TOTAL> timer;
|
Telemetry::AutoTimer<Telemetry::MAC_INITFONTLIST_TOTAL> timer;
|
||||||
|
|
||||||
|
InitSystemFontNames();
|
||||||
|
|
||||||
if (XRE_IsContentProcess()) {
|
if (XRE_IsContentProcess()) {
|
||||||
// Content process: use font list passed from the chrome process via
|
// Content process: use font list passed from the chrome process via
|
||||||
// the GetXPCOMProcessAttributes message, because it's much faster than
|
// the GetXPCOMProcessAttributes message, because it's much faster than
|
||||||
|
@ -932,6 +934,13 @@ nsresult gfxMacPlatformFontList::InitFontListForPlatform() {
|
||||||
for (FontFamilyListEntry& ffe : fontList) {
|
for (FontFamilyListEntry& ffe : fontList) {
|
||||||
switch (ffe.entryType()) {
|
switch (ffe.entryType()) {
|
||||||
case kStandardFontFamily:
|
case kStandardFontFamily:
|
||||||
|
// On Catalina or later, we pre-initialize system font-family entries
|
||||||
|
// in InitSystemFontNames(), so we can just skip them here.
|
||||||
|
if (nsCocoaFeatures::OnCatalinaOrLater() &&
|
||||||
|
(ffe.familyName() == mSystemTextFontFamilyName ||
|
||||||
|
ffe.familyName() == mSystemDisplayFontFamilyName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
AddFamily(ffe.familyName(), ffe.visibility());
|
AddFamily(ffe.familyName(), ffe.visibility());
|
||||||
break;
|
break;
|
||||||
case kTextSizeSystemFontFamily:
|
case kTextSizeSystemFontFamily:
|
||||||
|
@ -947,7 +956,6 @@ nsresult gfxMacPlatformFontList::InitFontListForPlatform() {
|
||||||
} else {
|
} else {
|
||||||
// We're not a content process, so get the available fonts directly
|
// We're not a content process, so get the available fonts directly
|
||||||
// from Core Text.
|
// from Core Text.
|
||||||
InitSystemFontNames();
|
|
||||||
CFArrayRef familyNames = CTFontManagerCopyAvailableFontFamilyNames();
|
CFArrayRef familyNames = CTFontManagerCopyAvailableFontFamilyNames();
|
||||||
for (NSString* familyName in (NSArray*)familyNames) {
|
for (NSString* familyName in (NSArray*)familyNames) {
|
||||||
AddFamily((CFStringRef)familyName);
|
AddFamily((CFStringRef)familyName);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче