Closed Bug 1393185 Opened 7 years ago Closed 7 years ago

Avoid refcount churn due to gfxFT2LockedFace

Categories

(Core :: Graphics: Text, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file)

As a temporary (stack-based) helper, gfxFT2LockedFace doesn't need to hold a strong reference to the gfxFT2FontBase. Doing so causes unnecessary refcount twiddling. This is particularly troublesome because gfxFT2LockedFace is used from within the gfxFontconfigFont constructor (via gfxFT2FontBase::InitMetrics), at which point the font being constructed has a refcount of zero. This means that using gfxFT2LockedFace to lock and access the FT_Face will bump the refcount to 1; then as the gfxFT2LockedFace goes out of scope again, the font's refcount drops back to zero; so gfxFont::Release figures we're done with the font and adds it to the gfxFontCache expiration-tracker list for eventual destruction -- though in practice we'll almost immediately bump its refcount again, when assigning the newly-created gfxFontconfigFont to a refptr somewhere, and take it back out of the expiration tracker. All that is a bunch of wasted work, AFAICS.
AFAICS, it should be safe to simplify like this.
Attachment #8900424 - Flags: review?(lsalzman)
Attachment #8900424 - Flags: review?(lsalzman) → review+
Whiteboard: [gfx-noted]
https://hg.mozilla.org/integration/mozilla-inbound/rev/ffc8b060039e2edb00174b71e02448b68f135239 Bug 1393185 - Annotate gfxFT2LockedFace as a stack-based helper, and avoid touching the refcount of the font. r=lsalzman
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Assignee: nobody → jfkthame
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: