Skip to content
  • wangxianzhu@chromium.org's avatar
    Basic enhancements to StringBuilder · b458c9cb
    wangxianzhu@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=67081
    
    Source/JavaScriptCore:
    
    This change contains the following enhancements to StringBuilder,
    for convenience, performance, testability, etc.:
    - Change toStringPreserveCapacity() to const
    - new public methods: capacity(), swap(), toAtomicString(), canShrink()
      and append(const StringBuilder&)
    - == and != opearators to compare StringBuilders and a StringBuilder/String
    
    Unit tests: Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp
    
    Reviewed by Darin Adler.
    
    * JavaScriptCore.exp:
    * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
    * wtf/text/AtomicString.cpp:
    (WTF::SubstringTranslator::hash):
    (WTF::SubstringTranslator::equal):
    (WTF::SubstringTranslator::translate):
    (WTF::AtomicString::add):
    (WTF::AtomicString::addSlowCase):
    * wtf/text/AtomicString.h:
    (WTF::AtomicString::AtomicString):
    (WTF::AtomicString::add):
    * wtf/text/StringBuilder.cpp:
    (WTF::StringBuilder::reifyString):
    (WTF::StringBuilder::resize):
    (WTF::StringBuilder::canShrink):
    (WTF::StringBuilder::shrinkToFit):
    * wtf/text/StringBuilder.h:
    (WTF::StringBuilder::append):
    (WTF::StringBuilder::toString):
    (WTF::StringBuilder::toStringPreserveCapacity):
    (WTF::StringBuilder::toAtomicString):
    (WTF::StringBuilder::isEmpty):
    (WTF::StringBuilder::capacity):
    (WTF::StringBuilder::is8Bit):
    (WTF::StringBuilder::swap):
    (WTF::equal):
    (WTF::operator==):
    (WTF::operator!=):
    * wtf/text/StringImpl.h:
    
    Source/WebCore:
    
    These changes are because we explicitly disallowed StringBuilder's
    copy constructor and assignment operator, and the change of return
    type of StringBuilder::toString().
    
    Reviewed by Darin Adler.
    
    No new tests. All layout tests and unit tests should run as before.
    
    * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
    (WebCore::MediaPlayerPrivateQuickTimeVisualContext::setUpCookiesForQuickTime):
    * svg/SVGPathStringBuilder.h:
    (WebCore::SVGPathStringBuilder::cleanup):
    
    Source/WebKit/chromium:
    
    This change is because we explicitly disallowed StringBuilder's
    copy constructor and assignment operator.
    
    Reviewed by Darin Adler.
    
    No new tests. All layout tests and unit tests should run as before.
    
    * src/WebPageSerializerImpl.cpp:
    (WebKit::WebPageSerializerImpl::encodeAndFlushBuffer):
    
    Tools:
    
    Reviewed by Darin Adler.
    
    * TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
    (TestWebKitAPI::TEST):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    b458c9cb