Replace more instances of += with StringBuilder
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Aug 2012 01:25:43 +0000 (01:25 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Aug 2012 01:25:43 +0000 (01:25 +0000)
commitcea3e08e164a704a1a4624604267418ab9399168
treeb00846fcf4bfbbbe04718239c7ef8764c0c565ed
parentc8661de9b7f86b5e3ad17e3965870e8c39445326
Replace more instances of += with StringBuilder
https://bugs.webkit.org/show_bug.cgi?id=95502

Reviewed by Darin Adler.

This patch removes many uses of WTF::String::operator+= in WebCore.
Many of these uses are inefficient because they cause us to allocate
and memcpy strings more times than necessary. In most cases, I've
replaced these inefficient patterns with StringBuilder.

This patch makes progress towards removing WTF::String::operator+= from
the project.

We can make cssText() more efficient by passing a single StringBuilder
instance along to the recursive calls, but I've left that for a later
patch.

* css/CSSBorderImageSliceValue.cpp:
(WebCore::CSSBorderImageSliceValue::customCssText):
* css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcValue::customCssText):
* css/CSSFunctionValue.cpp:
(WebCore::CSSFunctionValue::customCssText):
* css/CSSGradientValue.cpp:
(WebCore::CSSLinearGradientValue::customCssText):
(WebCore::CSSRadialGradientValue::customCssText):
* css/CSSParser.cpp:
(WebCore::CSSParser::createKeyframe):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::customCssText):
* css/CSSReflectValue.cpp:
(WebCore::CSSReflectValue::customCssText):
* css/CSSTimingFunctionValue.cpp:
(WebCore::CSSCubicBezierTimingFunctionValue::customCssText):
(WebCore::CSSStepsTimingFunctionValue::customCssText):
* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::get4Values):
(WebCore::StylePropertySet::getLayeredShorthandValue):
(WebCore::StylePropertySet::getShorthandValue):
* fileapi/BlobURL.cpp:
(WebCore::BlobURL::createBlobURL):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::SetPropertyTextAction::redo):
* inspector/InspectorClient.cpp:
(WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
* inspector/InspectorConsoleAgent.cpp:
(WebCore::InspectorConsoleAgent::didFailLoading):
* inspector/InspectorFileSystemAgent.cpp:
(WebCore):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::cachedResourceContent):
(WebCore::InspectorPageAgent::getCookies):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::addRule):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSBorderImageSliceValue.cpp
Source/WebCore/css/CSSFontFaceSrcValue.cpp
Source/WebCore/css/CSSFunctionValue.cpp
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSReflectValue.cpp
Source/WebCore/css/CSSTimingFunctionValue.cpp
Source/WebCore/fileapi/BlobURL.cpp
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorClient.cpp
Source/WebCore/inspector/InspectorConsoleAgent.cpp
Source/WebCore/inspector/InspectorFileSystemAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorStyleSheet.cpp