⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 127224 in webkit


Ignore:
Timestamp:
Aug 30, 2012, 6:25:43 PM (14 years ago)
Author:
abarth@webkit.org
Message:

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):

Location:
trunk/Source/WebCore
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r127220 r127224  
     12012-08-30  Adam Barth  <abarth@webkit.org>
     2
     3        Replace more instances of += with StringBuilder
     4        https://bugs.webkit.org/show_bug.cgi?id=95502
     5
     6        Reviewed by Darin Adler.
     7
     8        This patch removes many uses of WTF::String::operator+= in WebCore.
     9        Many of these uses are inefficient because they cause us to allocate
     10        and memcpy strings more times than necessary. In most cases, I've
     11        replaced these inefficient patterns with StringBuilder.
     12
     13        This patch makes progress towards removing WTF::String::operator+= from
     14        the project.
     15
     16        We can make cssText() more efficient by passing a single StringBuilder
     17        instance along to the recursive calls, but I've left that for a later
     18        patch.
     19
     20        * css/CSSBorderImageSliceValue.cpp:
     21        (WebCore::CSSBorderImageSliceValue::customCssText):
     22        * css/CSSFontFaceSrcValue.cpp:
     23        (WebCore::CSSFontFaceSrcValue::customCssText):
     24        * css/CSSFunctionValue.cpp:
     25        (WebCore::CSSFunctionValue::customCssText):
     26        * css/CSSGradientValue.cpp:
     27        (WebCore::CSSLinearGradientValue::customCssText):
     28        (WebCore::CSSRadialGradientValue::customCssText):
     29        * css/CSSParser.cpp:
     30        (WebCore::CSSParser::createKeyframe):
     31        * css/CSSPrimitiveValue.cpp:
     32        (WebCore::CSSPrimitiveValue::customCssText):
     33        * css/CSSReflectValue.cpp:
     34        (WebCore::CSSReflectValue::customCssText):
     35        * css/CSSTimingFunctionValue.cpp:
     36        (WebCore::CSSCubicBezierTimingFunctionValue::customCssText):
     37        (WebCore::CSSStepsTimingFunctionValue::customCssText):
     38        * css/StylePropertySet.cpp:
     39        (WebCore::StylePropertySet::get4Values):
     40        (WebCore::StylePropertySet::getLayeredShorthandValue):
     41        (WebCore::StylePropertySet::getShorthandValue):
     42        * fileapi/BlobURL.cpp:
     43        (WebCore::BlobURL::createBlobURL):
     44        * inspector/InspectorCSSAgent.cpp:
     45        (WebCore::InspectorCSSAgent::SetPropertyTextAction::redo):
     46        * inspector/InspectorClient.cpp:
     47        (WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
     48        * inspector/InspectorConsoleAgent.cpp:
     49        (WebCore::InspectorConsoleAgent::didFailLoading):
     50        * inspector/InspectorFileSystemAgent.cpp:
     51        (WebCore):
     52        * inspector/InspectorPageAgent.cpp:
     53        (WebCore::InspectorPageAgent::cachedResourceContent):
     54        (WebCore::InspectorPageAgent::getCookies):
     55        * inspector/InspectorStyleSheet.cpp:
     56        (WebCore::InspectorStyleSheet::addRule):
     57
    1582012-08-30  Luke Macpherson   <macpherson@chromium.org>
    259
  • trunk/Source/WebCore/css/CSSBorderImageSliceValue.cpp

    r124884 r127224  
    4747    // Now the fill keywords if it is present.
    4848    if (m_fill)
    49         text += " fill";
     49        return text + " fill";
    5050    return text;
    5151}
  • trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp

    r126154 r127224  
    3434#include "SVGFontFaceElement.h"
    3535#include "StyleSheetContents.h"
     36#include <wtf/text/StringBuilder.h>
    3637
    3738namespace WebCore {
    … …  
    6465String CSSFontFaceSrcValue::customCssText() const
    6566{
    66     String result;
     67    StringBuilder result;
    6768    if (isLocal())
    68         result += "local(";
     69        result.appendLiteral("local(");
    6970    else
    70         result += "url(";
    71     result += m_resource;
    72     result += ")";
    73     if (!m_format.isEmpty())
    74         result += " format(" + m_format + ")";
    75     return result;
     71        result.appendLiteral("url(");
     72    result.append(m_resource);
     73    result.append(')');
     74    if (!m_format.isEmpty()) {
     75        result.appendLiteral(" format(");
     76        result.append(m_format);
     77        result.append(')');
     78    }
     79    return result.toString();
    7680}
    7781
  • trunk/Source/WebCore/css/CSSFunctionValue.cpp

    r126154 r127224  
    3131#include "MemoryInstrumentation.h"
    3232#include <wtf/PassOwnPtr.h>
     33#include <wtf/text/StringBuilder.h>
    3334
    3435namespace WebCore {
    … …  
    4445String CSSFunctionValue::customCssText() const
    4546{
    46     String result = m_name; // Includes the '('
     47    StringBuilder result;
     48    result.append(m_name); // Includes the '('
    4749    if (m_args)
    48         result += m_args->cssText();
    49     result += ")";
    50     return result;
     50        result.append(m_args->cssText());
     51    result.append(')');
     52    return result.toString();
    5153}
    5254
  • trunk/Source/WebCore/css/CSSGradientValue.cpp

    r124884 r127224  
    3939#include "RenderObject.h"
    4040#include "StyleResolver.h"
     41#include <wtf/text/StringBuilder.h>
    4142
    4243using namespace std;
    … …  
    474475String CSSLinearGradientValue::customCssText() const
    475476{
    476     String result;
     477    StringBuilder result;
    477478    if (m_deprecatedType) {
    478         result = "-webkit-gradient(linear, ";
    479         result += m_firstX->cssText() + " ";
    480         result += m_firstY->cssText() + ", ";
    481         result += m_secondX->cssText() + " ";
    482         result += m_secondY->cssText();
     479        result.appendLiteral("-webkit-gradient(linear, ");
     480        result.append(m_firstX->cssText());
     481        result.append(' ');
     482        result.append(m_firstY->cssText());
     483        result.appendLiteral(", ");
     484        result.append(m_secondX->cssText());
     485        result.append(' ');
     486        result.append(m_secondY->cssText());
    483487
    484488        for (unsigned i = 0; i < m_stops.size(); i++) {
    485489            const CSSGradientColorStop& stop = m_stops[i];
    486             result += ", ";
    487             if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 0)
    488                 result += "from(" + stop.m_color->cssText() + ")";
    489             else if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 1)
    490                 result += "to(" + stop.m_color->cssText() + ")";
    491             else
    492                 result += "color-stop(" + String::number(stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER)) + ", " + stop.m_color->cssText() + ")";
     490            result.appendLiteral(", ");
     491            if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 0) {
     492                result.appendLiteral("from(");
     493                result.append(stop.m_color->cssText());
     494                result.append(')');
     495            } else if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 1) {
     496                result.appendLiteral("to(");
     497                result.append(stop.m_color->cssText());
     498                result.append(')');
     499            } else {
     500                result.appendLiteral("color-stop(");
     501                result.append(String::number(stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER)));
     502                result.appendLiteral(", ");
     503                result.append(stop.m_color->cssText());
     504                result.append(')');
     505            }
    493506        }
    494507    } else {
    495         result = m_repeating ? "-webkit-repeating-linear-gradient(" : "-webkit-linear-gradient(";
     508        if (m_repeating)
     509            result.appendLiteral("-webkit-repeating-linear-gradient(");
     510        else
     511            result.appendLiteral("-webkit-linear-gradient(");
     512
    496513        if (m_angle)
    497             result += m_angle->cssText();
     514            result.append(m_angle->cssText());
    498515        else {
    499             if (m_firstX && m_firstY)
    500                 result += m_firstX->cssText() + " " + m_firstY->cssText();
    501             else if (m_firstX || m_firstY) {
     516            if (m_firstX && m_firstY) {
     517                result.append(m_firstX->cssText());
     518                result.append(' ');
     519                result.append(m_firstY->cssText());
     520            } else if (m_firstX || m_firstY) {
    502521                if (m_firstX)
    503                     result += m_firstX->cssText();
     522                    result.append(m_firstX->cssText());
    504523
    505524                if (m_firstY)
    506                     result += m_firstY->cssText();
     525                    result.append(m_firstY->cssText());
    507526            }
    508527        }
    … …  
    510529        for (unsigned i = 0; i < m_stops.size(); i++) {
    511530            const CSSGradientColorStop& stop = m_stops[i];
    512             result += ", ";
    513             result += stop.m_color->cssText();
    514             if (stop.m_position)
    515                 result += " " + stop.m_position->cssText();
    516         }
    517     }
    518 
    519     result += ")";
    520     return result;
     531            result.appendLiteral(", ");
     532            result.append(stop.m_color->cssText());
     533            if (stop.m_position) {
     534                result.append(' ');
     535                result.append(stop.m_position->cssText());
     536            }
     537        }
     538    }
     539
     540    result.append(')');
     541    return result.toString();
    521542}
    522543
    … …  
    623644String CSSRadialGradientValue::customCssText() const
    624645{
    625     String result;
     646    StringBuilder result;
    626647
    627648    if (m_deprecatedType) {
    628         result = "-webkit-gradient(radial, ";
    629 
    630         result += m_firstX->cssText() + " ";
    631         result += m_firstY->cssText() + ", ";
    632         result += m_firstRadius->cssText() + ", ";
    633         result += m_secondX->cssText() + " ";
    634         result += m_secondY->cssText();
    635         result += ", ";
    636         result += m_secondRadius->cssText();
     649        result.appendLiteral("-webkit-gradient(radial, ");
     650        result.append(m_firstX->cssText());
     651        result.append(' ');
     652        result.append(m_firstY->cssText());
     653        result.appendLiteral(", ");
     654        result.append(m_firstRadius->cssText());
     655        result.appendLiteral(", ");
     656        result.append(m_secondX->cssText());
     657        result.append(' ');
     658        result.append(m_secondY->cssText());
     659        result.appendLiteral(", ");
     660        result.append(m_secondRadius->cssText());
    637661
    638662        // FIXME: share?
    639663        for (unsigned i = 0; i < m_stops.size(); i++) {
    640664            const CSSGradientColorStop& stop = m_stops[i];
    641             result += ", ";
    642             if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 0)
    643                 result += "from(" + stop.m_color->cssText() + ")";
    644             else if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 1)
    645                 result += "to(" + stop.m_color->cssText() + ")";
     665            result.appendLiteral(", ");
     666            if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 0) {
     667                result.appendLiteral("from(");
     668                result.append(stop.m_color->cssText());
     669                result.append(')');
     670            } else if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 1) {
     671                result.appendLiteral("to(");
     672                result.append(stop.m_color->cssText());
     673                result.append(')');
     674            } else {
     675                result.appendLiteral("color-stop(");
     676                result.append(String::number(stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER)));
     677                result.appendLiteral(", ");
     678                result.append(stop.m_color->cssText());
     679                result.append(')');
     680            }
     681        }
     682    } else {
     683        if (m_repeating)
     684            result.appendLiteral("-webkit-repeating-radial-gradient(");
     685        else
     686            result.appendLiteral("-webkit-radial-gradient(");
     687
     688        if (m_firstX && m_firstY) {
     689            result.append(m_firstX->cssText());
     690            result.append(' ');
     691            result.append(m_firstY->cssText());
     692        } else if (m_firstX)
     693            result.append(m_firstX->cssText());
     694         else if (m_firstY)
     695            result.append(m_firstY->cssText());
     696        else
     697            result.appendLiteral("center");
     698
     699        if (m_shape || m_sizingBehavior) {
     700            result.appendLiteral(", ");
     701            if (m_shape) {
     702                result.append(m_shape->cssText());
     703                result.append(' ');
     704            } else
     705                result.appendLiteral("ellipse ");
     706
     707            if (m_sizingBehavior)
     708                result.append(m_sizingBehavior->cssText());
    646709            else
    647                 result += "color-stop(" + String::number(stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER)) + ", " + stop.m_color->cssText() + ")";
    648         }
    649     } else {
    650 
    651         result = m_repeating ? "-webkit-repeating-radial-gradient(" : "-webkit-radial-gradient(";
    652         if (m_firstX && m_firstY) {
    653             result += m_firstX->cssText() + " " + m_firstY->cssText();
    654         } else if (m_firstX)
    655             result += m_firstX->cssText();
    656          else if (m_firstY)
    657             result += m_firstY->cssText();
    658         else
    659             result += "center";
    660 
    661 
    662         if (m_shape || m_sizingBehavior) {
    663             result += ", ";
    664             if (m_shape)
    665                 result += m_shape->cssText() + " ";
    666             else
    667                 result += "ellipse ";
    668 
    669             if (m_sizingBehavior)
    670                 result += m_sizingBehavior->cssText();
    671             else
    672                 result += "cover";
     710                result.appendLiteral("cover");
    673711
    674712        } else if (m_endHorizontalSize && m_endVerticalSize) {
    675             result += ", ";
    676             result += m_endHorizontalSize->cssText() + " " + m_endVerticalSize->cssText();
     713            result.appendLiteral(", ");
     714            result.append(m_endHorizontalSize->cssText());
     715            result.append(' ');
     716            result.append(m_endVerticalSize->cssText());
    677717        }
    678718
    679719        for (unsigned i = 0; i < m_stops.size(); i++) {
    680720            const CSSGradientColorStop& stop = m_stops[i];
    681             result += ", ";
    682             result += stop.m_color->cssText();
    683             if (stop.m_position)
    684                 result += " " + stop.m_position->cssText();
    685         }
    686     }
    687 
    688     result += ")";
    689     return result;
     721            result.appendLiteral(", ");
     722            result.append(stop.m_color->cssText());
     723            if (stop.m_position) {
     724                result.append(' ');
     725                result.append(stop.m_position->cssText());
     726            }
     727        }
     728    }
     729
     730    result.append(')');
     731    return result.toString();
    690732}
    691733
  • trunk/Source/WebCore/css/CSSParser.cpp

    r127220 r127224  
    99549954{
    99559955    // Create a key string from the passed keys
    9956     String keyString;
     9956    StringBuilder keyString;
    99579957    for (unsigned i = 0; i < keys->size(); ++i) {
    99589958        float key = static_cast<float>(keys->valueAt(i)->fValue);
    99599959        if (i != 0)
    9960             keyString += ",";
    9961         keyString += String::number(key);
    9962         keyString += "%";
     9960            keyString.append(',');
     9961        keyString.append(String::number(key));
     9962        keyString.append('%');
    99639963    }
    99649964
    99659965    RefPtr<StyleKeyframe> keyframe = StyleKeyframe::create();
    9966     keyframe->setKeyText(keyString);
     9966    keyframe->setKeyText(keyString.toString());
    99679967    keyframe->setProperties(createStylePropertySet());
    99689968
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r127220 r127224  
    953953        }
    954954        case CSS_COUNTER_NAME:
    955             text = "counter(";
    956             text += m_value.string;
    957             text += ")";
     955            text = "counter(" + String(m_value.string) + ')';
    958956            break;
    959957        case CSS_COUNTER: {
    … …  
    10391037            break;
    10401038        }
    1041         case CSS_PAIR:
    1042             text = m_value.pair->first()->cssText();
     1039        case CSS_PAIR: {
     1040            StringBuilder result;
     1041            result.append(m_value.pair->first()->cssText());
    10431042            if (m_value.pair->second() != m_value.pair->first()) {
    1044                 text += " ";
    1045                 text += m_value.pair->second()->cssText();
     1043                result.append(' ');
     1044                result.append(m_value.pair->second()->cssText());
    10461045            }
    1047             break;
     1046            text = result.toString();
     1047            break;
     1048        }
    10481049#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION)
    1049         case CSS_DASHBOARD_REGION:
     1050        case CSS_DASHBOARD_REGION: {
     1051            StringBuilder result;
    10501052            for (DashboardRegion* region = getDashboardRegionValue(); region; region = region->m_next.get()) {
    1051                 if (!text.isEmpty())
    1052                     text.append(' ');
     1053                if (!result.isEmpty())
     1054                    result.append(' ');
    10531055#if ENABLE(DASHBOARD_SUPPORT) && ENABLE(WIDGET_REGION)
    1054                 text += region->m_cssFunctionName;
     1056                result.append(region->m_cssFunctionName);
    10551057#elif ENABLE(DASHBOARD_SUPPORT)
    1056                 text += "dashboard-region(";
     1058                result.appendLiteral("dashboard-region(");
    10571059#else
    1058                 text += "region(";
    1059 #endif
    1060                 text += region->m_label;
     1060                result.appendLiteral("region(");
     1061#endif
     1062                result.append(region->m_label);
    10611063                if (region->m_isCircle)
    1062                     text += " circle";
     1064                    result.appendLiteral(" circle");
    10631065                else if (region->m_isRectangle)
    1064                     text += " rectangle";
     1066                    result.appendLiteral(" rectangle");
    10651067                else
    10661068                    break;
    … …  
    10731075                    ASSERT(region->left()->getIdent() == CSSValueInvalid);
    10741076                } else {
    1075                     text.append(' ');
    1076                     text += region->top()->cssText() + " ";
    1077                     text += region->right()->cssText() + " ";
    1078                     text += region->bottom()->cssText() + " ";
    1079                     text += region->left()->cssText();
     1077                    result.append(' ');
     1078                    result.append(region->top()->cssText());
     1079                    result.append(' ');
     1080                    result.append(region->right()->cssText());
     1081                    result.append(' ');
     1082                    result.append(region->bottom()->cssText());
     1083                    result.append(' ');
     1084                    result.append(region->left()->cssText());
    10801085                }
    1081                 text += ")";
     1086                result.append(')');
    10821087            }
    1083             break;
     1088            text = result.toString();
     1089            break;
     1090        }
    10841091#endif
    10851092        case CSS_PARSER_OPERATOR: {
    … …  
    11081115#if ENABLE(CSS_VARIABLES)
    11091116        case CSS_VARIABLE_NAME:
    1110             text = "-webkit-var(";
    1111             text += m_value.string;
    1112             text += ")";
     1117            text = "-webkit-var(" + String(m_value.string) + ")";
    11131118            break;
    11141119#endif
  • trunk/Source/WebCore/css/CSSReflectValue.cpp

    r124884 r127224  
    3030#include "MemoryInstrumentation.h"
    3131#include "PlatformString.h"
     32#include <wtf/text/StringBuilder.h>
    3233
    3334using namespace std;
    … …  
    3738String CSSReflectValue::customCssText() const
    3839{
    39     String result;
     40    StringBuilder result;
    4041    switch (m_direction) {
    4142        case ReflectionBelow:
    42             result += "below ";
     43            result.appendLiteral("below ");
    4344            break;
    4445        case ReflectionAbove:
    45             result += "above ";
     46            result.appendLiteral("above ");
    4647            break;
    4748        case ReflectionLeft:
    48             result += "left ";
     49            result.appendLiteral("left ");
    4950            break;
    5051        case ReflectionRight:
    51             result += "right ";
     52            result.appendLiteral("right ");
    5253            break;
    5354        default:
    … …  
    5556    }
    5657
    57     result += m_offset->cssText() + " ";
     58    result.append(m_offset->cssText());
     59    result.append(' ');
    5860    if (m_mask)
    59         result += m_mask->cssText();
    60     return result;
     61        result.append(m_mask->cssText());
     62    return result.toString();
    6163}
    6264
  • trunk/Source/WebCore/css/CSSTimingFunctionValue.cpp

    r124884 r127224  
    4444String CSSCubicBezierTimingFunctionValue::customCssText() const
    4545{
    46     String text("cubic-bezier(");
    47     text += String::number(m_x1);
    48     text += ", ";
    49     text += String::number(m_y1);
    50     text += ", ";
    51     text += String::number(m_x2);
    52     text += ", ";
    53     text += String::number(m_y2);
    54     text += ")";
    55     return text;
     46    return "cubic-bezier("
     47        + String::number(m_x1) + ", "
     48        + String::number(m_y1) + ", "
     49        + String::number(m_x2) + ", "
     50        + String::number(m_y2) + ")";
    5651}
    5752
    … …  
    6358String CSSStepsTimingFunctionValue::customCssText() const
    6459{
    65     String text("steps(");
    66     text += String::number(m_steps);
    67     text += ", ";
    68     text += m_stepAtStart ? "start" : "end";
    69     text += ")";
    70     return text;
     60    return "steps(" + String::number(m_steps) + ", " + (m_stepAtStart ? "start" : "end") + ')';
    7161}
    7262
  • trunk/Source/WebCore/fileapi/BlobURL.cpp

    r120433 r127224  
    7373{
    7474    ASSERT(!originString.isEmpty());
    75     String urlString = kBlobProtocol;
    76     urlString += ":";
    77     urlString += encodeWithURLEscapeSequences(originString);
    78     urlString += "/";
    79     urlString += createCanonicalUUIDString();
     75    String urlString = "blob:" + encodeWithURLEscapeSequences(originString) + '/' + createCanonicalUUIDString();
    8076    return KURL(ParsedURLString, urlString);
    8177}
  • trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp

    r126968 r127224  
    327327        // FIXME: remove this once the model handles this case.
    328328        if (!m_oldText.endsWith(';'))
    329             m_oldText += ";";
     329            m_oldText.append(';');
    330330        return result;
    331331    }
  • trunk/Source/WebCore/inspector/InspectorClient.cpp

    r110854 r127224  
    5656        return false;
    5757
    58     String dispatchToFrontend("WebInspector.dispatchMessageFromBackend(");
    59     dispatchToFrontend += message;
    60     dispatchToFrontend += ");";
     58    String dispatchToFrontend = "WebInspector.dispatchMessageFromBackend(" + message + ");";
    6159
    6260    // FIXME: This should execute the script in the appropriate world.
  • trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp

    r126967 r127224  
    4848#include <wtf/OwnPtr.h>
    4949#include <wtf/PassOwnPtr.h>
     50#include <wtf/text/StringBuilder.h>
    5051#include <wtf/text/WTFString.h>
    5152
    … …  
    250251    if (error.isCancellation()) // Report failures only.
    251252        return;
    252     String message = ASCIILiteral("Failed to load resource");
    253     if (!error.localizedDescription().isEmpty())
    254         message += ": " + error.localizedDescription();
     253    StringBuilder message;
     254    message.appendLiteral("Failed to load resource");
     255    if (!error.localizedDescription().isEmpty()) {
     256        message.appendLiteral(": ");
     257        message.append(error.localizedDescription());
     258    }
    255259    String requestId = IdentifiersFactory::requestId(identifier);
    256     addConsoleMessage(adoptPtr(new ConsoleMessage(NetworkMessageSource, LogMessageType, ErrorMessageLevel, message, error.failingURL(), requestId)));
     260    addConsoleMessage(adoptPtr(new ConsoleMessage(NetworkMessageSource, LogMessageType, ErrorMessageLevel, message.toString(), error.failingURL(), requestId)));
    257261}
    258262
  • trunk/Source/WebCore/inspector/InspectorFileSystemAgent.cpp

    r126279 r127224  
    583583    RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType, m_charset, true);
    584584    String result = decoder->decode(static_cast<char*>(buffer->data()), buffer->byteLength());
    585     result += decoder->flush();
     585    result.append(decoder->flush());
    586586    m_charset = decoder->encoding().domName();
    587587    reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset);
  • trunk/Source/WebCore/inspector/InspectorPageAgent.cpp

    r126926 r127224  
    7575#include "TextResourceDecoder.h"
    7676#include "UserGestureIndicator.h"
    77 
    7877#include <wtf/CurrentTime.h>
    7978#include <wtf/ListHashSet.h>
    8079#include <wtf/Vector.h>
    8180#include <wtf/text/Base64.h>
     81#include <wtf/text/StringBuilder.h>
    8282
    8383using namespace std;
    … …  
    198198                return false;
    199199            String content = decoder->decode(buffer->data(), buffer->size());
    200             content += decoder->flush();
    201             *result = content;
     200            *result = content + decoder->flush();
    202201            return true;
    203202        }
    … …  
    504503
    505504    // If we can't get raw cookies - fall back to String representation
    506     String stringCookiesList;
     505    StringBuilder stringCookiesList;
    507506
    508507    // Return value to getRawCookies should be the same for every call because
    … …  
    520519                // FIXME: We need duplication checking for the String representation of cookies.
    521520                ExceptionCode ec = 0;
    522                 stringCookiesList += document->cookie(ec);
     521                stringCookiesList.append(document->cookie(ec));
    523522                // Exceptions are thrown by cookie() in sandboxed frames. That won't happen here
    524523                // because "document" is the document of the main frame of the page.
    … …  
    540539    } else {
    541540        cookies = TypeBuilder::Array<TypeBuilder::Page::Cookie>::create();
    542         *cookiesString = stringCookiesList;
     541        *cookiesString = stringCookiesList.toString();
    543542    }
    544543}
  • trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp

    r127000 r127224  
    802802CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionCode& ec)
    803803{
    804     String styleSheetText;
    805     bool success = getText(&styleSheetText);
     804    String text;
     805    bool success = getText(&text);
    806806    if (!success) {
    807807        ec = NOT_FOUND_ERR;
    808808        return 0;
    809809    }
     810    StringBuilder styleSheetText;
     811    styleSheetText.append(text);
    810812
    811813    m_pageStyleSheet->addRule(selector, "", ec);
    … …  
    816818    ASSERT(rule);
    817819
    818     if (styleSheetText.length())
    819         styleSheetText += "\n";
    820 
    821     styleSheetText += selector;
    822     styleSheetText += " {}";
     820    if (!styleSheetText.isEmpty())
     821        styleSheetText.append('\n');
     822
     823    styleSheetText.append(selector);
     824    styleSheetText.appendLiteral(" {}");
    823825    // Using setText() as this operation changes the style sheet rule set.
    824     setText(styleSheetText);
     826    setText(styleSheetText.toString());
    825827
    826828    fireStyleSheetChanged();
Note: See TracChangeset for help on using the changeset viewer.