Basic enhancements to StringBuilder
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jan 2012 20:42:05 +0000 (20:42 +0000)
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jan 2012 20:42:05 +0000 (20:42 +0000)
commit506a5afc390adc8b2b2b3dfe894ee2447e96792a
tree6ca2fc57dc7d251cf689820dc80d28e21c98e1b3
parent1eb47c1a275b371b4f78e8ffcf35c7d63969b8bc
Basic enhancements to StringBuilder
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: https://svn.webkit.org/repository/webkit/trunk@105635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.exp
Source/JavaScriptCore/JavaScriptCore.order
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/wtf/text/AtomicString.cpp
Source/JavaScriptCore/wtf/text/AtomicString.h
Source/JavaScriptCore/wtf/text/StringBuilder.cpp
Source/JavaScriptCore/wtf/text/StringBuilder.h
Source/JavaScriptCore/wtf/text/StringImpl.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
Source/WebCore/svg/SVGPathStringBuilder.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebPageSerializerImpl.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp