Closed Bug 97969 Opened 23 years ago Closed 17 years ago

nsFontMetrics{GTK,Xlib} use FMR-able nsCStringKey construction pattern

Categories

(Core :: Layout, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX
Future

People

(Reporter: dbaron, Unassigned)

References

Details

(Keywords: fonts)

Attachments

(1 file)

I wrote in review comments on bug 95621 (this applies to both nsFontMetricsGTK.cpp and nsFontMetricsXlib.cpp): * aFFREName should be |const nsACString&|, not |nsAWritableCString&| * the nsCStringKey constructed from aFFREName in TryNode should be constructed without PromiseFlatCString (or .get()), since this code would crash if the string isn't already flat (although it is). * in the code that's actually in the patch, you should use NS_LITERAL_CSTRING to pass the string to TryNode, rather than constructing an nsCAutoString (expensive) and copying the buffer (expensive) I'm particularly worried about the second point, since the pattern you use is one that would crash if used on a non-flat string. (Yes, ns[C]StringKey needs to be brought into the modern world once our main string implementation is sharable, but we're better off keeping it the quirky way it is now until then. Either way, you're better off just passing the string directly without the promise since ns[C]StringKey would take care of things just as well after any such rewrite if you let it handle things rather than doing them yourself.) The third point could also be a bit of a performance gain.
Although, actually, if you want the best performance, you'd be better making aFFREName an |const nsAFlatString&| so that you can get the nsCStringKey constructor that has better performance (based on static typing determination of flatness).
Blocks: 79119
Filed prototype patch. I am not sure whether all things are "right"... ;-/ Comments ?
No. You added another copy rather than removing the one that was already there. You need to change the type of the string passed to TryNode as well, and use NS_LITERAL_CSTRING at the caller of TryNode (rather than nsCAutoString). (You should also change |nsAWritableString &oPattern| to |nsAString &oPattern|, since nsAWritableString is deprecated.)
Scott, I do not see any mention of ns[C]StringKey in http://lxr.mozilla.org/seamonkey/source/string/doc/string-guide.html Care to elaborate?
Status: NEW → ASSIGNED
Target Milestone: --- → Future
Keywords: fonts
Scott, are you there?
What is it that you need to know?
I would like to see some documentation to go along with the changes scc made to the string API.
What's odd here isn't the string API -- it's nsCStringKey, which, when constructed on the stack (with OWN_CLONE, the default ownership model), expects the string it's given to last longer than it does.
--> ftang
Assignee: bstell → ftang
Status: ASSIGNED → NEW
bulk move NEW FUTURE bug to ASSIGN
Status: NEW → ASSIGNED
what a hack. I have not touch mozilla code for 2 years. I didn't read these bugs for 2 years. And they are still there. Just close them as won't fix to clean up.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → WONTFIX
Mass Re-open of Frank Tangs Won't fix debacle. Spam is his responsibility not my own
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Mass Re-assinging Frank Tangs old bugs that he closed won't fix and had to be re-open. Spam is his fault not my own
Assignee: ftang → nobody
Status: REOPENED → NEW
we don't have nsFontMetrics{GTK,Xlib} any more --> WONTFIX
Status: NEW → RESOLVED
Closed: 20 years ago17 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: