Title: [183031] trunk/Source
Revision
183031
Author
commit-qu...@webkit.org
Date
2015-04-20 15:07:31 -0700 (Mon, 20 Apr 2015)

Log Message

Cleanup some StringBuilder use
https://bugs.webkit.org/show_bug.cgi?id=143550

Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-04-20
Reviewed by Darin Adler.

Source/_javascript_Core:

* runtime/Symbol.cpp:
(JSC::Symbol::descriptiveString):
* runtime/TypeProfiler.cpp:
(JSC::TypeProfiler::typeInformationForExpressionAtOffset):
* runtime/TypeSet.cpp:
(JSC::TypeSet::toJSONString):
(JSC::StructureShape::propertyHash):
(JSC::StructureShape::stringRepresentation):
(JSC::StructureShape::toJSONString):

Source/WebCore:

* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::youTubeURL):
* css/CSSAnimationTriggerScrollValue.cpp:
(WebCore::CSSAnimationTriggerScrollValue::customCSSText):
* css/CSSCanvasValue.cpp:
(WebCore::CSSCanvasValue::customCSSText):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createImageBuffer):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsWindowCSS):
(WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS):
(WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor):
(WebCore::CaptionUserPreferencesMediaAF::colorPropertyCSS):
(WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
(WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride):
* page/EventSource.cpp:
(WebCore::EventSource::didReceiveResponse):
* page/PageSerializer.cpp:
(WebCore::PageSerializer::serializeCSSStyleSheet):
* platform/graphics/OpenGLShims.cpp:
(WebCore::lookupOpenGLFunctionAddress):
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processCueAttributes):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::generateHashedName):
* platform/text/DateTimeFormat.cpp:
(WebCore::DateTimeFormat::quoteAndAppendLiteral):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo):
* rendering/RenderTreeAsText.cpp:
(WebCore::writeRenderRegionList):
* testing/MicroTaskTest.cpp:
(WebCore::MicroTaskTest::run):
* testing/MockContentFilterSettings.cpp:
(WebCore::MockContentFilterSettings::unblockRequestURL):

Source/WebKit2:

* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
(WebKit::buildObjectStoreStatement):
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::v2RecordsTableSchema):
* Shared/Databases/IndexedDB/IDBUtilities.cpp:
(WebKit::uniqueDatabaseIdentifier):
* UIProcess/API/APIUserScript.cpp:
(API::UserScript::generateUniqueURL):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::didReceiveInvalidMessage):
* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
(WebKit::combinedSecurityOriginIdentifier):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (183030 => 183031)


--- trunk/Source/_javascript_Core/ChangeLog	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-04-20 22:07:31 UTC (rev 183031)
@@ -1,3 +1,20 @@
+2015-04-20  Joseph Pecoraro  <pecor...@apple.com>
+
+        Cleanup some StringBuilder use
+        https://bugs.webkit.org/show_bug.cgi?id=143550
+
+        Reviewed by Darin Adler.
+
+        * runtime/Symbol.cpp:
+        (JSC::Symbol::descriptiveString):
+        * runtime/TypeProfiler.cpp:
+        (JSC::TypeProfiler::typeInformationForExpressionAtOffset):
+        * runtime/TypeSet.cpp:
+        (JSC::TypeSet::toJSONString):
+        (JSC::StructureShape::propertyHash):
+        (JSC::StructureShape::stringRepresentation):
+        (JSC::StructureShape::toJSONString):
+
 2015-04-20  Mark Lam  <mark....@apple.com>
 
         Add debugging tools to test if a given pointer is a valid object and in the heap.

Modified: trunk/Source/_javascript_Core/runtime/Symbol.cpp (183030 => 183031)


--- trunk/Source/_javascript_Core/runtime/Symbol.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/_javascript_Core/runtime/Symbol.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -95,11 +95,7 @@
 
 String Symbol::descriptiveString() const
 {
-    StringBuilder builder;
-    builder.appendLiteral("Symbol(");
-    builder.append(privateName().uid());
-    builder.append(')');
-    return builder.toString();
+    return makeString("Symbol(", String(privateName().uid()), ')');
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/TypeProfiler.cpp (183030 => 183031)


--- trunk/Source/_javascript_Core/runtime/TypeProfiler.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/_javascript_Core/runtime/TypeProfiler.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -82,27 +82,27 @@
 
     StringBuilder json;  
 
-    json.append("{");
+    json.append('{');
 
-    json.append("\"globalTypeSet\":");
+    json.appendLiteral("\"globalTypeSet\":");
     if (location->m_globalTypeSet && location->m_globalVariableID != TypeProfilerNoGlobalIDExists)
         json.append(location->m_globalTypeSet->toJSONString());
     else
-        json.append("null");
-    json.append(",");
+        json.appendLiteral("null");
+    json.append(',');
 
-    json.append("\"instructionTypeSet\":");
+    json.appendLiteral("\"instructionTypeSet\":");
     json.append(location->m_instructionTypeSet->toJSONString());
-    json.append(",");
+    json.append(',');
 
-    json.append("\"isOverflown\":");
+    json.appendLiteral("\"isOverflown\":");
     if (location->m_instructionTypeSet->isOverflown() || (location->m_globalTypeSet && location->m_globalTypeSet->isOverflown()))
-        json.append("true");
+        json.appendLiteral("true");
     else
-        json.append("false");
+        json.appendLiteral("false");
 
 
-    json.append("}");
+    json.append('}');
     
     return json.toString();
 }

Modified: trunk/Source/_javascript_Core/runtime/TypeSet.cpp (183030 => 183031)


--- trunk/Source/_javascript_Core/runtime/TypeSet.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/_javascript_Core/runtime/TypeSet.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -250,73 +250,73 @@
     //     structures: 'Array<JSON<StructureShape>>'
 
     StringBuilder json;
-    json.append("{");
+    json.append('{');
 
-    json.append("\"displayTypeName\":");
-    json.append("\"");
+    json.appendLiteral("\"displayTypeName\":");
+    json.append('"');
     json.append(displayName());
-    json.append("\"");
-    json.append(",");
+    json.append('"');
+    json.append(',');
 
-    json.append("\"primitiveTypeNames\":");
-    json.append("[");
+    json.appendLiteral("\"primitiveTypeNames\":");
+    json.append('[');
     bool hasAnItem = false;
     if (m_seenTypes & TypeUndefined) {
         hasAnItem = true;
-        json.append("\"Undefined\"");
+        json.appendLiteral("\"Undefined\"");
     }
     if (m_seenTypes & TypeNull) {
         if (hasAnItem)
-            json.append(",");
+            json.append(',');
         hasAnItem = true;
-        json.append("\"Null\"");
+        json.appendLiteral("\"Null\"");
     }
     if (m_seenTypes & TypeBoolean) {
         if (hasAnItem)
-            json.append(",");
+            json.append(',');
         hasAnItem = true;
-        json.append("\"Boolean\"");
+        json.appendLiteral("\"Boolean\"");
     }
     if (m_seenTypes & TypeMachineInt) {
         if (hasAnItem)
-            json.append(",");
+            json.append(',');
         hasAnItem = true;
-        json.append("\"Integer\"");
+        json.appendLiteral("\"Integer\"");
     }
     if (m_seenTypes & TypeNumber) {
         if (hasAnItem)
-            json.append(",");
+            json.append(',');
         hasAnItem = true;
-        json.append("\"Number\"");
+        json.appendLiteral("\"Number\"");
     }
     if (m_seenTypes & TypeString) {
         if (hasAnItem)
-            json.append(",");
+            json.append(',');
         hasAnItem = true;
-        json.append("\"String\"");
+        json.appendLiteral("\"String\"");
     }
     if (m_seenTypes & TypeSymbol) {
         if (hasAnItem)
-            json.append(",");
+            json.append(',');
         hasAnItem = true;
-        json.append("\"Symbol\"");
+        json.appendLiteral("\"Symbol\"");
     }
-    json.append("]");
+    json.append(']');
 
-    json.append(",");
+    json.append(',');
 
-    json.append("\"structures\":");
-    json.append("[");
+    json.appendLiteral("\"structures\":");
+    json.append('[');
     hasAnItem = false;
     for (size_t i = 0; i < m_structureHistory.size(); i++) {
         if (hasAnItem)
-            json.append(",");
+            json.append(',');
         hasAnItem = true;
         json.append(m_structureHistory[i]->toJSONString());
     }
-    json.append("]");
+    json.append(']');
 
-    json.append("}");
+    json.append('}');
     return json.toString();
 }
 
@@ -359,7 +359,7 @@
 
     if (m_proto) {
         builder.append(':');
-        builder.append("__proto__");
+        builder.appendLiteral("__proto__");
         builder.append(m_proto->propertyHash());
     }
 
@@ -409,13 +409,13 @@
         for (auto it = curShape->m_fields.begin(), end = curShape->m_fields.end(); it != end; ++it) {
             String prop((*it).get());
             representation.append(prop);
-            representation.append(", ");
+            representation.appendLiteral(", ");
         }
 
         if (curShape->m_proto) {
-            String prot = makeString("__proto__ [", curShape->m_proto->m_constructorName, ']');
-            representation.append(prot);
-            representation.append(", ");
+            representation.appendLiteral("__proto__ [");
+            representation.append(curShape->m_proto->m_constructorName);
+            representation.appendLiteral("], ");
         }
 
         curShape = curShape->m_proto;
@@ -438,60 +438,60 @@
     //     proto: 'JSON<StructureShape> | null'
 
     StringBuilder json;
-    json.append("{");
+    json.append('{');
 
-    json.append("\"constructorName\":");
-    json.append("\"");
+    json.appendLiteral("\"constructorName\":");
+    json.append('"');
     json.append(m_constructorName);
-    json.append("\"");
-    json.append(",");
+    json.append('"');
+    json.append(',');
 
-    json.append("\"isInDictionaryMode\":");
+    json.appendLiteral("\"isInDictionaryMode\":");
     if (m_isInDictionaryMode)
-        json.append("true");
+        json.appendLiteral("true");
     else
-        json.append("false");
-    json.append(",");
+        json.appendLiteral("false");
+    json.append(',');
 
-    json.append("\"fields\":");
-    json.append("[");
+    json.appendLiteral("\"fields\":");
+    json.append('[');
     bool hasAnItem = false;
     for (auto it = m_fields.begin(), end = m_fields.end(); it != end; ++it) {
         if (hasAnItem)
-            json.append(",");
+            json.append(',');
         hasAnItem = true;
 
         String fieldName((*it).get());
-        json.append("\"");
+        json.append('"');
         json.append(fieldName);
-        json.append("\"");
+        json.append('"');
     }
-    json.append("]");
-    json.append(",");
+    json.append(']');
+    json.append(',');
 
-    json.append("\"optionalFields\":");
-    json.append("[");
+    json.appendLiteral("\"optionalFields\":");
+    json.append('[');
     hasAnItem = false;
     for (auto it = m_optionalFields.begin(), end = m_optionalFields.end(); it != end; ++it) {
         if (hasAnItem)
-            json.append(",");
+            json.append(',');
         hasAnItem = true;
 
         String fieldName((*it).get());
-        json.append("\"");
+        json.append('"');
         json.append(fieldName);
-        json.append("\"");
+        json.append('"');
     }
-    json.append("]");
-    json.append(",");
+    json.append(']');
+    json.append(',');
 
-    json.append("\"proto\":");
+    json.appendLiteral("\"proto\":");
     if (m_proto)
         json.append(m_proto->toJSONString());
     else
-        json.append("null");
+        json.appendLiteral("null");
 
-    json.append("}");
+    json.append('}');
 
     return json.toString();
 }

Modified: trunk/Source/WebCore/ChangeLog (183030 => 183031)


--- trunk/Source/WebCore/ChangeLog	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/ChangeLog	2015-04-20 22:07:31 UTC (rev 183031)
@@ -1,3 +1,46 @@
+2015-04-20  Joseph Pecoraro  <pecor...@apple.com>
+
+        Cleanup some StringBuilder use
+        https://bugs.webkit.org/show_bug.cgi?id=143550
+
+        Reviewed by Darin Adler.
+
+        * Modules/plugins/YouTubePluginReplacement.cpp:
+        (WebCore::YouTubePluginReplacement::youTubeURL):
+        * css/CSSAnimationTriggerScrollValue.cpp:
+        (WebCore::CSSAnimationTriggerScrollValue::customCSSText):
+        * css/CSSCanvasValue.cpp:
+        (WebCore::CSSCanvasValue::customCSSText):
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::createImageBuffer):
+        * page/CaptionUserPreferencesMediaAF.cpp:
+        (WebCore::CaptionUserPreferencesMediaAF::captionsWindowCSS):
+        (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS):
+        (WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor):
+        (WebCore::CaptionUserPreferencesMediaAF::colorPropertyCSS):
+        (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
+        (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride):
+        * page/EventSource.cpp:
+        (WebCore::EventSource::didReceiveResponse):
+        * page/PageSerializer.cpp:
+        (WebCore::PageSerializer::serializeCSSStyleSheet):
+        * platform/graphics/OpenGLShims.cpp:
+        (WebCore::lookupOpenGLFunctionAddress):
+        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
+        (WebCore::InbandTextTrackPrivateAVF::processCueAttributes):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::generateHashedName):
+        * platform/text/DateTimeFormat.cpp:
+        (WebCore::DateTimeFormat::quoteAndAppendLiteral):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::logLayerInfo):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::writeRenderRegionList):
+        * testing/MicroTaskTest.cpp:
+        (WebCore::MicroTaskTest::run):
+        * testing/MockContentFilterSettings.cpp:
+        (WebCore::MockContentFilterSettings::unblockRequestURL):
+
 2015-04-20  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         SVGFitToViewBox::viewBoxToViewTransform() has to count for zero physical width and height before calling SVGPreserveAspectRatio::getCTM()

Modified: trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp (183030 => 183031)


--- trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -326,13 +326,13 @@
     // See: <rdar://problem/11535155>
     StringBuilder finalURL;
     if (isYouTubeShortenedURL)
-        finalURL.append("http://www.youtube.com");
+        finalURL.appendLiteral("http://www.youtube.com");
     else
         finalURL.append(srcURLPrefix);
     finalURL.appendLiteral("/embed/");
     finalURL.append(videoID);
     if (!query.isEmpty()) {
-        finalURL.appendLiteral("?");
+        finalURL.append('?');
         finalURL.append(query);
     }
     return finalURL.toString();

Modified: trunk/Source/WebCore/css/CSSAnimationTriggerScrollValue.cpp (183030 => 183031)


--- trunk/Source/WebCore/css/CSSAnimationTriggerScrollValue.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/css/CSSAnimationTriggerScrollValue.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -35,10 +35,10 @@
 String CSSAnimationTriggerScrollValue::customCSSText() const
 {
     StringBuilder result;
-    result.append("container-scroll(");
+    result.appendLiteral("container-scroll(");
     result.append(m_startValue->cssText());
     if (m_endValue) {
-        result.append(", ");
+        result.appendLiteral(", ");
         result.append(m_endValue->cssText());
     }
     result.append(')');

Modified: trunk/Source/WebCore/css/CSSCanvasValue.cpp (183030 => 183031)


--- trunk/Source/WebCore/css/CSSCanvasValue.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/css/CSSCanvasValue.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -28,7 +28,6 @@
 
 #include "ImageBuffer.h"
 #include "RenderElement.h"
-#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -40,11 +39,7 @@
 
 String CSSCanvasValue::customCSSText() const
 {
-    StringBuilder result;
-    result.appendLiteral("-webkit-canvas(");
-    result.append(m_name);
-    result.append(')');
-    return result.toString();
+    return makeString("-webkit-canvas(", m_name, ')');
 }
 
 void CSSCanvasValue::canvasChanged(HTMLCanvasElement&, const FloatRect& changedRect)

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (183030 => 183031)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -558,9 +558,9 @@
 
     if (deviceSize.width() * deviceSize.height() > MaxCanvasArea) {
         StringBuilder stringBuilder;
-        stringBuilder.append("Canvas area exceeds the maximum limit (width * height > ");
+        stringBuilder.appendLiteral("Canvas area exceeds the maximum limit (width * height > ");
         stringBuilder.appendNumber(MaxCanvasArea);
-        stringBuilder.append(").");
+        stringBuilder.appendLiteral(").");
         document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, stringBuilder.toString());
         return;
     }

Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (183030 => 183031)


--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -234,12 +234,7 @@
     if (!opacity)
         return windowStyle;
 
-    StringBuilder builder;
-    builder.append(windowStyle);
-    builder.append(getPropertyNameString(CSSPropertyPadding));
-    builder.append(": .4em !important;");
-
-    return builder.toString();
+    return makeString(windowStyle, getPropertyNameString(CSSPropertyPadding), ": .4em !important;");
 }
 
 String CaptionUserPreferencesMediaAF::captionsBackgroundCSS() const
@@ -300,7 +295,7 @@
     builder.append(getPropertyNameString(CSSPropertyBorderRadius));
     builder.append(String::format(":%.02fpx", radius));
     if (behavior == kMACaptionAppearanceBehaviorUseValue)
-        builder.append(" !important");
+        builder.appendLiteral(" !important");
     builder.append(';');
 
     return builder.toString();
@@ -327,7 +322,7 @@
     builder.append(' ');
     builder.append(captionsEdgeColorForTextColor(textColor).serialized());
     if (important)
-        builder.append(" !important");
+        builder.appendLiteral(" !important");
     builder.append(';');
     
     return builder.toString();
@@ -341,7 +336,7 @@
     builder.append(':');
     builder.append(color.serialized());
     if (important)
-        builder.append(" !important");
+        builder.appendLiteral(" !important");
     builder.append(';');
     
     return builder.toString();
@@ -399,11 +394,11 @@
     StringBuilder builder;
     
     builder.append(getPropertyNameString(CSSPropertyFontFamily));
-    builder.append(": \"");
+    builder.appendLiteral(": \"");
     builder.append(static_cast<CFStringRef>(name.get()));
     builder.append('"');
     if (behavior == kMACaptionAppearanceBehaviorUseValue)
-        builder.append(" !important");
+        builder.appendLiteral(" !important");
     builder.append(';');
     
     return builder.toString();
@@ -490,7 +485,7 @@
     String fontName = captionsDefaultFontCSS();
     String background = ""
     if (!background.isEmpty() || !captionsColor.isEmpty() || !edgeStyle.isEmpty() || !fontName.isEmpty()) {
-        captionsOverrideStyleSheet.append(" video::");
+        captionsOverrideStyleSheet.appendLiteral(" video::");
         captionsOverrideStyleSheet.append(TextTrackCue::cueShadowPseudoId());
         captionsOverrideStyleSheet.append('{');
         
@@ -509,7 +504,7 @@
     String windowColor = captionsWindowCSS();
     String windowCornerRadius = windowRoundedCornerRadiusCSS();
     if (!windowColor.isEmpty() || !windowCornerRadius.isEmpty()) {
-        captionsOverrideStyleSheet.append(" video::");
+        captionsOverrideStyleSheet.appendLiteral(" video::");
         captionsOverrideStyleSheet.append(VTTCue::cueBackdropShadowPseudoId());
         captionsOverrideStyleSheet.append('{');
         

Modified: trunk/Source/WebCore/page/EventSource.cpp (183030 => 183031)


--- trunk/Source/WebCore/page/EventSource.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/page/EventSource.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -53,7 +53,6 @@
 #include "SerializedScriptValue.h"
 #include "TextResourceDecoder.h"
 #include "ThreadableLoader.h"
-#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -223,22 +222,16 @@
         // If we have a charset, the only allowed value is UTF-8 (case-insensitive).
         responseIsValid = charset.isEmpty() || equalIgnoringCase(charset, "UTF-8");
         if (!responseIsValid) {
-            StringBuilder message;
-            message.appendLiteral("EventSource's response has a charset (\"");
-            message.append(charset);
-            message.appendLiteral("\") that is not UTF-8. Aborting the connection.");
+            String message = makeString("EventSource's response has a charset (\"", charset, "\") that is not UTF-8. Aborting the connection.");
             // FIXME: We are missing the source line.
-            scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, message.toString());
+            scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, message);
         }
     } else {
         // To keep the signal-to-noise ratio low, we only log 200-response with an invalid MIME type.
         if (statusCode == 200 && !mimeTypeIsValid) {
-            StringBuilder message;
-            message.appendLiteral("EventSource's response has a MIME type (\"");
-            message.append(response.mimeType());
-            message.appendLiteral("\") that is not \"text/event-stream\". Aborting the connection.");
+            String message = makeString("EventSource's response has a MIME type (\"", response.mimeType(), "\") that is not \"text/event-stream\". Aborting the connection.");
             // FIXME: We are missing the source line.
-            scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, message.toString());
+            scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, message);
         }
     }
 

Modified: trunk/Source/WebCore/page/PageSerializer.cpp (183030 => 183031)


--- trunk/Source/WebCore/page/PageSerializer.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/page/PageSerializer.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -262,7 +262,7 @@
         if (!itemText.isEmpty()) {
             cssText.append(itemText);
             if (i < styleSheet->length() - 1)
-                cssText.append("\n\n");
+                cssText.appendLiteral("\n\n");
         }
         Document* document = styleSheet->ownerDocument();
         // Some rules have resources associated with them that we need to retrieve.

Modified: trunk/Source/WebCore/platform/graphics/OpenGLShims.cpp (183030 => 183031)


--- trunk/Source/WebCore/platform/graphics/OpenGLShims.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/platform/graphics/OpenGLShims.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -70,26 +70,18 @@
     if (target)
         return target;
 
-    String fullFunctionName(functionName);
-    fullFunctionName.append("ARB");
-    target = getProcAddress(fullFunctionName.utf8().data());
+    target = getProcAddress(makeString(functionName, "ARB").characters8());
     if (target)
         return target;
 
-    fullFunctionName = functionName;
-    fullFunctionName.append("EXT");
-    target = getProcAddress(fullFunctionName.utf8().data());
+    target = getProcAddress(makeString(functionName, "EXT").characters8());
 
 #if defined(GL_ES_VERSION_2_0)
-    fullFunctionName = functionName;
-    fullFunctionName.append("ANGLE");
-    target = getProcAddress(fullFunctionName.utf8().data());
+    target = getProcAddress(makeString(functionName, "ANGLE").characters8());
     if (target)
         return target;
 
-    fullFunctionName = functionName;
-    fullFunctionName.append("APPLE");
-    target = getProcAddress(fullFunctionName.utf8().data());
+    target = getProcAddress(makeString(functionName, "APPLE").characters8());
 #endif
 
     // A null address is still a failure case.

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp (183030 => 183031)


--- trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -158,7 +158,7 @@
                 if (static_cast<CFBooleanRef>(value) != kCFBooleanTrue)
                     continue;
 
-                tagStart.append("<b>");
+                tagStart.appendLiteral("<b>");
                 tagEnd = "</b>" + tagEnd;
                 continue;
             }
@@ -167,7 +167,7 @@
                 if (static_cast<CFBooleanRef>(value) != kCFBooleanTrue)
                     continue;
 
-                tagStart.append("<i>");
+                tagStart.appendLiteral("<i>");
                 tagEnd = "</i>" + tagEnd;
                 continue;
             }
@@ -176,7 +176,7 @@
                 if (static_cast<CFBooleanRef>(value) != kCFBooleanTrue)
                     continue;
 
-                tagStart.append("<u>");
+                tagStart.appendLiteral("<u>");
                 tagEnd = "</u>" + tagEnd;
                 continue;
             }

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (183030 => 183031)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -851,7 +851,7 @@
         return name;
     uint64_t number = nameHashForShader(name.utf8().data(), name.length());
     StringBuilder builder;
-    builder.append("webgl_");
+    builder.appendLiteral("webgl_");
     appendUnsigned64AsHex(number, builder, Lowercase);
     return builder.toString();
 }

Modified: trunk/Source/WebCore/platform/text/DateTimeFormat.cpp (183030 => 183031)


--- trunk/Source/WebCore/platform/text/DateTimeFormat.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/platform/text/DateTimeFormat.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -265,7 +265,7 @@
 
     for (unsigned i = 0; i < literal.length(); ++i) {
         if (literal[i] == '\'')
-            buffer.append("''");
+            buffer.appendLiteral("''");
         else {
             String escaped = literal.substring(i);
             escaped.replace('\'', "''");

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (183030 => 183031)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -837,17 +837,17 @@
         absoluteBounds.x().toFloat(), absoluteBounds.y().toFloat(), absoluteBounds.maxX().toFloat(), absoluteBounds.maxY().toFloat(),
         backing->backingStoreMemoryEstimate() / 1024));
     
-    logString.append(" (");
+    logString.appendLiteral(" (");
     logString.append(logReasonsForCompositing(layer));
-    logString.append(") ");
+    logString.appendLiteral(") ");
 
     if (backing->graphicsLayer()->contentsOpaque() || backing->paintsIntoCompositedAncestor()) {
         logString.append('[');
         if (backing->graphicsLayer()->contentsOpaque())
-            logString.append("opaque");
+            logString.appendLiteral("opaque");
         if (backing->paintsIntoCompositedAncestor())
-            logString.append("paints into ancestor");
-        logString.append("] ");
+            logString.appendLiteral("paints into ancestor");
+        logString.appendLiteral("] ");
     }
 
     logString.append(layer.name());

Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (183030 => 183031)


--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -667,9 +667,9 @@
             RenderElement* renderElementForRegion = isRenderNamedFlowFragment ? renderRegion->parent() : renderRegion;
             if (renderElementForRegion->isPseudoElement()) {
                 if (renderElementForRegion->element()->isBeforePseudoElement())
-                    tagName.append("::before");
+                    tagName.appendLiteral("::before");
                 else if (renderElementForRegion->element()->isAfterPseudoElement())
-                    tagName.append("::after");
+                    tagName.appendLiteral("::after");
             }
 
             ts << " {" << tagName.toString() << "}";

Modified: trunk/Source/WebCore/testing/MicroTaskTest.cpp (183030 => 183031)


--- trunk/Source/WebCore/testing/MicroTaskTest.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/testing/MicroTaskTest.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -27,12 +27,8 @@
 
 void MicroTaskTest::run()
 {
-    StringBuilder message;
-    message.append("MicroTask #");
-    message.append(String::number(m_testNumber));
-    message.append(" has run.");
     if (m_document)
-        m_document->addConsoleMessage(MessageSource::JS, MessageLevel::Debug, message.toString());
+        m_document->addConsoleMessage(MessageSource::JS, MessageLevel::Debug, makeString("MicroTask #", String::number(m_testNumber), " has run."));
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/testing/MockContentFilterSettings.cpp (183030 => 183031)


--- trunk/Source/WebCore/testing/MockContentFilterSettings.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebCore/testing/MockContentFilterSettings.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -30,9 +30,7 @@
 
 #include "ContentFilter.h"
 #include "ContentFilterUnblockHandler.h"
-#include <mutex>
 #include <wtf/NeverDestroyed.h>
-#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -49,15 +47,7 @@
 
 const String& MockContentFilterSettings::unblockRequestURL() const
 {
-    static LazyNeverDestroyed<String> unblockRequestURL;
-    static std::once_flag onceFlag;
-    std::call_once(onceFlag, [] {
-        StringBuilder unblockRequestURLBuilder;
-        unblockRequestURLBuilder.append(ContentFilter::urlScheme());
-        unblockRequestURLBuilder.append("://");
-        unblockRequestURLBuilder.append(unblockURLHost());
-        unblockRequestURL.construct(unblockRequestURLBuilder.toString());
-    });
+    static NeverDestroyed<String> unblockRequestURL = makeString(ContentFilter::urlScheme(), "://", unblockURLHost());
     return unblockRequestURL;
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (183030 => 183031)


--- trunk/Source/WebKit2/ChangeLog	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-20 22:07:31 UTC (rev 183031)
@@ -1,3 +1,23 @@
+2015-04-20  Joseph Pecoraro  <pecor...@apple.com>
+
+        Cleanup some StringBuilder use
+        https://bugs.webkit.org/show_bug.cgi?id=143550
+
+        Reviewed by Darin Adler.
+
+        * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
+        (WebKit::buildObjectStoreStatement):
+        * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
+        (WebKit::v2RecordsTableSchema):
+        * Shared/Databases/IndexedDB/IDBUtilities.cpp:
+        (WebKit::uniqueDatabaseIdentifier):
+        * UIProcess/API/APIUserScript.cpp:
+        (API::UserScript::generateUniqueURL):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::didReceiveInvalidMessage):
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
+        (WebKit::combinedSecurityOriginIdentifier):
+
 2015-04-20  Anders Carlsson  <ander...@apple.com>
 
         Modify the WKWebsiteDataStore API to take a NSSet of types instead of a bitmask

Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp (183030 => 183031)


--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -117,7 +117,7 @@
     builder.appendLiteral(" CAST(? AS TEXT) ORDER BY key");
 
     if (cursorDirection == IndexedDB::CursorDirection::Prev || cursorDirection == IndexedDB::CursorDirection::PrevNoDuplicate)
-        builder.append(" DESC");
+        builder.appendLiteral(" DESC");
 
     builder.append(';');
 

Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp (183030 => 183031)


--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -64,10 +64,9 @@
 static const String v2RecordsTableSchema(const String& tableName)
 {
     StringBuilder builder;
-    builder.append("CREATE TABLE ");
+    builder.appendLiteral("CREATE TABLE ");
     builder.append(tableName);
-    builder.append(" (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL, value NOT NULL ON CONFLICT FAIL)");
-
+    builder.appendLiteral(" (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL, value NOT NULL ON CONFLICT FAIL)");
     return builder.toString();
 }
 

Modified: trunk/Source/WebKit2/Shared/Databases/IndexedDB/IDBUtilities.cpp (183030 => 183031)


--- trunk/Source/WebKit2/Shared/Databases/IndexedDB/IDBUtilities.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebKit2/Shared/Databases/IndexedDB/IDBUtilities.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -42,14 +42,14 @@
     if (originString == "null")
         return String();
     stringBuilder.append(originString);
-    stringBuilder.append("_");
+    stringBuilder.append('_');
 
     originString = mainFrameOrigin.toString();
     if (originString == "null")
         return String();
     stringBuilder.append(originString);
 
-    stringBuilder.append("_");
+    stringBuilder.append('_');
     stringBuilder.append(databaseName);
 
     return stringBuilder.toString();

Modified: trunk/Source/WebKit2/UIProcess/API/APIUserScript.cpp (183030 => 183031)


--- trunk/Source/WebKit2/UIProcess/API/APIUserScript.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserScript.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -40,7 +40,7 @@
 WebCore::URL UserScript::generateUniqueURL()
 {
     StringBuilder urlStringBuilder;
-    urlStringBuilder.append("user-script:");
+    urlStringBuilder.appendLiteral("user-script:");
     urlStringBuilder.appendNumber(generateIdentifier());
     return WebCore::URL { WebCore::URL { }, urlStringBuilder.toString() };
 }

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (183030 => 183031)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -562,7 +562,7 @@
 
     StringBuilder messageNameStringBuilder;
     messageNameStringBuilder.append(messageReceiverName.data(), messageReceiverName.size());
-    messageNameStringBuilder.append(".");
+    messageNameStringBuilder.append('.');
     messageNameStringBuilder.append(messageName.data(), messageName.size());
 
     s_invalidMessageCallback(toAPI(API::String::create(messageNameStringBuilder.toString()).get()));

Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp (183030 => 183031)


--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp	2015-04-20 22:05:52 UTC (rev 183030)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp	2015-04-20 22:07:31 UTC (rev 183031)
@@ -70,7 +70,7 @@
     if (originString == "null")
         return String();
     stringBuilder.append(originString);
-    stringBuilder.append("_");
+    stringBuilder.append('_');
 
     originString = mainFrameOrigin.toString();
     if (originString == "null")
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to