Closed Bug 1674868 Opened 4 years ago Closed 4 years ago

Make native-font-resource-mac memory reporter expandable and add font list with details

Categories

(Core :: Graphics, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: whimboo, Assigned: bradwerth)

References

Details

Attachments

(3 files, 2 obsolete files)

+++ This bug was initially created as a clone of Bug #1674175 +++

To have a better idea were memory has been allocated we should display a list of native fonts as created under native-font-resource-mac including the font family, URL, and principal similar to user-fonts:

├──9.69 MB (01.21%) -- user-fonts
│    │  ├──1.43 MB (00.18%) ── font(family=Twemoji, url=https://chat.mozilla.org/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.5bb743a.woff2, principal=https://chat.mozilla.org/#/room/#interop:mozilla.org)
│    │  ├──0.34 MB (00.04%) ── font(family=docs-EB Garamond, url=https://fonts.gstatic.com/s/ebgaramond/v14/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-6_RUAIV-e62PgQ.woff, principal=https://docs.google.com/document/d/13Ecva5JMjeCTteDUd4bpvGyCVNq2T2ZthRABW_XE5UA/edit#)  

Yeah, we should be able to at least pull the family out of the font and add that to the set tracking the native font resource data here:
https://searchfox.org/mozilla-central/source/gfx/2d/NativeFontResourceMac.cpp#78

Assignee: nobody → bwerth

The new helper function AllocateCGFontFromData can be used to create the
font reference objects from the cached font data in sWeakFontDataSet, which
will be useful for memory reporting.

Attachment #9185909 - Attachment is obsolete: true
Attachment #9185901 - Attachment is obsolete: true

Any CT "Create" method returns an owned object. This ensures that owned
objects are deallocated when the font fails to be crated. It also prevents
unused font data from being entered into the font data set (where it would
never be deallocated).

This moves from unordered_set to unordered_map to accommodate storing the font
name alongside the font data.

Depends on D96121

If there is no font name stored, this reports "Unknown(#)" with the index of
the font in the map.

Depends on D96122

Pushed by bwerth@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5015220441e6 Part 1: Prevent memory leaks in NativeFontResourceMac::Create when font creation fails. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/5028739d84dd Part 2: Make NativeFontResourceMac store native font names alongside raw font data. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/3d281d6985bf Part 3: Make NativeFontResourceMacReporter report each native font by name. r=jrmuizel

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #0)

├──9.69 MB (01.21%) -- user-fonts
│    │  ├──1.43 MB (00.18%) ── font(family=Twemoji, url=https://chat.mozilla.org/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.5bb743a.woff2, principal=https://chat.mozilla.org/#/room/#interop:mozilla.org)
│    │  ├──0.34 MB (00.04%) ── font(family=docs-EB Garamond, url=https://fonts.gstatic.com/s/ebgaramond/v14/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-6_RUAIV-e62PgQ.woff, principal=https://docs.google.com/document/d/13Ecva5JMjeCTteDUd4bpvGyCVNq2T2ZthRABW_XE5UA/edit#)  

So compared to user fonts I see a different reporting for native font resource:

│  ├──200.45 MB (32.20%) -- native-font-resource-mac
│  │  ├──198.30 MB (31.86%) ── AppleColorEmoji

Aren't we able to use the same details? It would be really good to know which site actually loaded the font.

Flags: needinfo?(bwerth)

It's not all that valuable because with the patches from bug 1625590 we will stop allocating data for that font.

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #9)

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #0)

├──9.69 MB (01.21%) -- user-fonts
│    │  ├──1.43 MB (00.18%) ── font(family=Twemoji, url=https://chat.mozilla.org/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.5bb743a.woff2, principal=https://chat.mozilla.org/#/room/#interop:mozilla.org)
│    │  ├──0.34 MB (00.04%) ── font(family=docs-EB Garamond, url=https://fonts.gstatic.com/s/ebgaramond/v14/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-6_RUAIV-e62PgQ.woff, principal=https://docs.google.com/document/d/13Ecva5JMjeCTteDUd4bpvGyCVNq2T2ZthRABW_XE5UA/edit#)  

So compared to user fonts I see a different reporting for native font resource:

│  ├──200.45 MB (32.20%) -- native-font-resource-mac
│  │  ├──198.30 MB (31.86%) ── AppleColorEmoji

Aren't we able to use the same details? It would be really good to know which site actually loaded the font.

I'll open a new bug to make the native-font-resource-mac format match the user-fonts format.

Flags: needinfo?(bwerth)
Blocks: 1676255
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: