Closed Bug 112548 Opened 23 years ago Closed 15 years ago

integrate atoms with the string hierarchy

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: dbaron, Assigned: jag+mozilla)

Details

Attachments

(1 file)

I think it would be useful to integrate atoms with the string hierarchy in some way. We spend a good bit of time (close to 1% of new-window time for the navigator window) coping strings out of atoms. Perhaps the best solution would be to make AtomImpl::ToString assign from an nsSharedBufferHandleWithAllocator<PRUnichar> whose allocator holds a reference count on the atom. The cleanest way to do this would perhaps be to, within that ToString method, construct a string object on the stack that implemented |const nsAFlatString| and returned an appropriate new buffer handle if GetSharedBufferHandle were called. (It could even hold on to the buffer handle and free it in the destructor if the caller didn't add a reference.) This might require implementation (and renaming) of kIsShared so that we don't try to modify the buffer, though!
A better solution than allocating a new buffer handle would be to either: * put the buffer handle inside the atom * give the atom class a pointer to the buffer handle, so that once we call ToString on an atom once, we have the buffer handle as long as the atom lasts.
...but we can't do the first of the above because we call |delete| on the buffer handle.
I'd like to get the changes in mozilla/string in for this milestone, since they fix two serious bugs with nsSharableString (although one of the two fixes may be a temporary solution -- see the comment in the patch).
Comment on attachment 61050 [details] [diff] [review] working patch, although with too much memory churn r=jag
Attachment #61050 - Flags: review+
Comment on attachment 61050 [details] [diff] [review] working patch, although with too much memory churn I moved the mozilla/string part of this patch to bug 114438.
giving up ancient string bugs to the new string owner. jag, you'll want to sort through these and see which ones still apply and go with or against the direction in which you intend strings evolve
Assignee: scc → jaggernaut
QA Contact: jag → string
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INCOMPLETE
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: