Teach more WTF string classes about vectors with inline capacity
Created attachment 187940 [details] Patch
Comment on attachment 187940 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187940&action=review > Source/WTF/ChangeLog:9 > + I'm about to deploy these all over the HTML/WebVTT parser code > + to make our string creation much less verbose. Let's explain the changes here instead! > Source/WTF/wtf/text/AtomicString.h:67 > + > + template<size_t inlineCapacity> > + explicit AtomicString(Vector<UChar, inlineCapacity> characters) > + : m_string(add(characters.data(), characters.size())) > + { > + } > + This is in the middle of the two constructor from literal. I would instead put this close to the constructors taking a UChar*
Created attachment 187946 [details] Patch for landing
Comment on attachment 187946 [details] Patch for landing Clearing flags on attachment: 187946 Committed r142689: <http://trac.webkit.org/changeset/142689>
All reviewed patches have been landed. Closing bug.
Comment on attachment 187946 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=187946&action=review > Source/WTF/wtf/text/AtomicString.h:53 > + explicit AtomicString(Vector<UChar, inlineCapacity> characters) This is bad for performance. It copies the vector before creating the atomic string! Please use const Vector& instead of Vector as the argument type. > Source/WTF/wtf/text/StringImpl.h:358 > + static PassRefPtr<StringImpl> create8BitIfPossible(Vector<UChar, inlineCapacity> vector) Same problem here.
Comment on attachment 187946 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=187946&action=review >> Source/WTF/wtf/text/AtomicString.h:53 >> + explicit AtomicString(Vector<UChar, inlineCapacity> characters) > > This is bad for performance. It copies the vector before creating the atomic string! Please use const Vector& instead of Vector as the argument type. Ouch! Yes. Fixing now.
Comment on attachment 187946 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=187946&action=review >>> Source/WTF/wtf/text/AtomicString.h:53 >>> + explicit AtomicString(Vector<UChar, inlineCapacity> characters) >> >> This is bad for performance. It copies the vector before creating the atomic string! Please use const Vector& instead of Vector as the argument type. > > Ouch! Yes. Fixing now. Fixed: bug 109708. In doing this I found that wtf/dota/ uses Vector<char> as an argument all over the place! I suspect it was re-written on top of WTF from stl w/o realizing this. I've filed bug 109709.