[Webkit-unassigned] [Bug 67079] Replace usages of Vector<UChar> with existing StringBuilder

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 29 21:38:29 PDT 2011


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


Xianzhu Wang <wangxianzhu at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #105476|0                           |1
        is obsolete|                            |
 Attachment #105574|                            |review?
               Flag|                            |




--- Comment #10 from Xianzhu Wang <wangxianzhu at chromium.org>  2011-08-29 21:38:28 PST ---
Created an attachment (id=105574)
 --> (https://bugs.webkit.org/attachment.cgi?id=105574&action=review)
patch v3

Thanks Gavin and Darin for review!

> This patch looks good, would be great to be able to remove the String::adopt method, do you know how far this takes us in that direction?
I think this patch has replaced more than 80% Vector<UChar> usages and almost all String::adopt usages. The remaining places depend on other bugs blocking bug 66661 and will be fixed soon.

>> Source/WebCore/platform/text/TextStream.cpp:87
>>      size_t stringLength = strlen(string);
> 
> I think this function should just be
> { m_text.append(string); return *this; }
> 
> (If the StringBuilder needs to grow the buffer it should be checking for overflow itself).

Done.

>> Source/WebCore/xml/parser/CharacterReferenceParserInlineMethods.h:47
>> +        source.prepend(SegmentedString(String(consumedCharacters.characters(), consumedCharacters.length())));
> 
> To get the current contents of a StringBuilder as a String you could call
> consumedCharacters.toString()
> (or maybe consumedCharacters.toStringPreserveCapacity() )
> instead of "String(consumedCharacters.characters(), consumedCharacters.length())".

For now both toString() and toStringPreserveCapacity() alters the internal state and are non-const. They can't be used here because consumedCharacters is const.
My plan is to make toStringPreserveCapacity() const (also make StringBuilder::m_string mutable). This will be done in bug 67081.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list