Closed Bug 118918 Opened 23 years ago Closed 23 years ago

Change nsIPresContext::GetDefaultFont() to avoid copy

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: rbs, Assigned: rbs)

Details

Attachments

(1 file)

Currently, the API is defined as: NS_IMETHOD nsIPresContext::GetDefaultFont(PRUint8 aFontID, nsFont& aResult) And it showed up in one of the perf data posted by dbaron sometimes ago in the n.p.m.performance newsgroup, see http://groups.google.com/groups?th=4600cc6332ac246d&rnum=1 Although its impact is marginal it can be eliminated totally from the perf radar by a simple change to a version that doesn't copy, e.g, NS_IMETHOD nsIPresContext::GetDefaultFont(PRUint8 aFontID, const nsFont*& aResult) so that a consumer can just do const nsFont* font; aPresContex->GetDefaultFont(aFontID, font); ... see it and nothing to free() since the signature implies that nothing is ... allocated for you
Seeking hot r/sr
Comment on attachment 64099 [details] [diff] [review] collated patch in layout + content + xmlterm r=dbaron, although in general I prefer getters that take |const nsFont**| (so that it's clear from the calling code that the variable is to be filled in by the function rather than passed to the function), so I don't mind if you change that. ...I'd really love to see all that no-longer-used "quirks" form control code go away sometime...
Attachment #64099 - Flags: review+
OK, will switch to your suggested signature. I don't mind it too.
Yeah, do what dbaron suggests and sr=waterson.
Fixed using |const nsFont**|.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: