[Webkit-unassigned] [Bug 141558] [GTK] GObject DOM bindings object are cached forever

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 17 01:41:52 PST 2015


https://bugs.webkit.org/show_bug.cgi?id=141558

--- Comment #4 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to comment #3)
> (In reply to comment #2)
> > > Source/WebCore/bindings/gobject/DOMObjectCache.cpp:139
> > > +    Vector<DOMObjectCacheData*> m_objects;
> > 
> > Since respecting the insertion order is not needed, I think we should use a
> > HashSet here. Being a set means that we can be sure that the objects are
> > only once in the data structure and will also help with searches (contains()
> > and the like).
> 
> It was a HashSet initially, I don't remember why I changed to a Vector.

I remember now. Switched to a Vector in the end mainly because of removeFirstMatching() that makes very convenient to find the data containing the GObject that has finalized. Note that we don't actually need hashes here, adding the same object twice would be a bug, and there's an assert for that case indeed. We always want either iterate all the elements, or find a particular element, but not using the data pointer, but the GObject, because in objectFinalizedCallback we don't have the data pointer corresponding to the finalized GObject. Also, all the contains uses are inside asserts. We could improve a bit the Vector by stack allocating a few entries, 8 for example.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150217/f2b24887/attachment-0002.html>


More information about the webkit-unassigned mailing list