RESOLVED FIXED 98683
SVGResources should use HashSet<AtomicString> instead of HashSet<AtomicStringImpl*>
https://bugs.webkit.org/show_bug.cgi?id=98683
Summary SVGResources should use HashSet<AtomicString> instead of HashSet<AtomicString...
Eric Seidel (no email)
Reported 2012-10-08 13:37:36 PDT
SVGResources should use HashSet<AtomicString> instead of HashSet<AtomicStringImpl*> They do basically the same thing, and the former is much more common (and less code). It's also safe, on the off-chance that we're using AtomicStrings which might otherwise go away.
Attachments
Patch (10.95 KB, patch)
2012-10-09 08:19 PDT, Florin Malita
no flags
Patch for landing (10.94 KB, patch)
2012-10-09 10:58 PDT, Florin Malita
no flags
Florin Malita
Comment 1 2012-10-09 08:19:33 PDT
Darin Adler
Comment 2 2012-10-09 10:05:20 PDT
Comment on attachment 167759 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=167759&action=review > Source/WebCore/rendering/svg/SVGResources.cpp:205 > + AtomicString tagName = element->tagQName().localName(); This adds a bit of reference count churn. If we know that the element won’t be deleted while we’re working on it, we could use const AtomicString& as the type instead. > Source/WebCore/rendering/svg/SVGResources.cpp:206 > + if (tagName.isEmpty()) I think we only need an isNull check here. An isEmpty check is both more expensive than a null check, and also may not be correct since the old code did a null check. I wonder if we have test coverage for the empty string case?
Eric Seidel (no email)
Comment 3 2012-10-09 10:25:46 PDT
Comment on attachment 167759 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=167759&action=review >> Source/WebCore/rendering/svg/SVGResources.cpp:205 >> + AtomicString tagName = element->tagQName().localName(); > > This adds a bit of reference count churn. If we know that the element won’t be deleted while we’re working on it, we could use const AtomicString& as the type instead. Also, I think you can just call element->localName() directly and don't have to go through the qname?
Florin Malita
Comment 4 2012-10-09 10:58:25 PDT
Thanks for reviewing, updated. (In reply to comment #2) > > Source/WebCore/rendering/svg/SVGResources.cpp:205 > > + AtomicString tagName = element->tagQName().localName(); > > This adds a bit of reference count churn. If we know that the element won’t be deleted while we’re working on it, we could use const AtomicString& as the type instead. Done. > > Source/WebCore/rendering/svg/SVGResources.cpp:206 > > + if (tagName.isEmpty()) > > I think we only need an isNull check here. An isEmpty check is both more expensive than a null check, and also may not be correct since the old code did a null check. I wonder if we have test coverage for the empty string case? Good point, should avoid changing behavior here. Even if it's possible to get an empty tag name here, it shouldn't have any impact as it will just skip through the remaining conditionals and return false. Updated. (In reply to comment #3) > Also, I think you can just call element->localName() directly and don't have to go through the qname? Done.
Florin Malita
Comment 5 2012-10-09 10:58:48 PDT
Created attachment 167786 [details] Patch for landing
WebKit Review Bot
Comment 6 2012-10-09 11:36:13 PDT
Comment on attachment 167786 [details] Patch for landing Clearing flags on attachment: 167786 Committed r130780: <http://trac.webkit.org/changeset/130780>
WebKit Review Bot
Comment 7 2012-10-09 11:36:16 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.