Ignore:
Timestamp:
May 24, 2021, 2:51:47 PM (4 years ago)
Author:
Darin Adler
Message:

Remove StringBuilder::appendLiteral
https://bugs.webkit.org/show_bug.cgi?id=226137

Reviewed by Chris Dumez.

Source/JavaScriptCore:

  • API/tests/PingPongStackOverflowTest.cpp:

(PingPongStackOverflowObject_hasInstance): Use append instead of appendLiteral.

  • bindings/ScriptFunctionCall.cpp:

(Deprecated::ScriptCallArgumentHandler::appendArgument): Remove unnecessary cast
from const char* to String, which defeats optimization and has no benefit.

  • bytecompiler/NodesCodegen.cpp:

(JSC::ArrayPatternNode::toString const): Use append instead of appendLiteral.
(JSC::RestParameterNode::toString const): Ditto.

  • heap/HeapSnapshotBuilder.cpp:

(JSC::HeapSnapshotBuilder::json): Use append instead of appendLiteral.
Removed unnecesary use of appendQuotedJSONString to append the result of
snapshotTypeToString and edgeTypeToString, which return a const char* that
never contains characters that require special quoting consideration, so
can be appended efficiently with the normal append function.

  • inspector/agents/InspectorAuditAgent.cpp:

(Inspector::InspectorAuditAgent::run): Use makeString instead of StringBuilder.

  • inspector/agents/InspectorConsoleAgent.cpp: Use auto for the result of makeString.
  • jsc.cpp: Use appned instead of appendLiteral.
  • parser/ParserArena.cpp:

(JSC::IdentifierArena::makePrivateIdentifier): Use auto for the result of makeString.

  • runtime/ConsoleClient.cpp:

(JSC::ConsoleClient::printConsoleMessage): Use append instead of appendLiteral.
Also use variadic append when practical for better efficiency.
(JSC::ConsoleClient::printConsoleMessageWithArguments): Ditto.

  • runtime/DateConversion.cpp:

(JSC::formatDateTime): Ditto.

  • runtime/ErrorInstance.cpp:

(JSC::ErrorInstance::sanitizedToString): Use makeString instead of StringBuilder.

  • runtime/ExceptionHelpers.cpp:

(JSC::notAFunctionSourceAppender): Use append instead of appendLiteral.

  • runtime/IntlDateTimeFormat.cpp:

(JSC::IntlDateTimeFormat::initializeDateTimeFormat): Ditto.

  • runtime/IntlNumberFormat.cpp:

(JSC::IntlNumberFormat::initializeNumberFormat): Ditto.

  • runtime/JSCustomGetterFunction.cpp:

(JSC::JSCustomGetterFunction::create): Use auto and cut down on reference count
churn by using passing the StringImpl to makeString.

  • runtime/JSCustomSetterFunction.cpp:

(JSC::JSCustomSetterFunction::create): Ditto.

  • runtime/JSGlobalObjectFunctions.cpp: Use more const and use variadic

append for better efficiency.

  • runtime/JSONObject.cpp:

(JSC::Stringifier::appendStringifiedValue): Use append instead of appendLiteral.
(JSC::Stringifier::Holder::appendNextProperty): Ditto.

  • runtime/JSStringJoiner.h: Deleted unused appendLiteral function.

Unrelated to StringBuilder::appendLiteral, but dead code.

  • runtime/Options.cpp:

(JSC::Options::dumpOption): Use append instead of appendLiteral.

  • runtime/RegExpPrototype.cpp:

(JSC::appendLineTerminatorEscape<UChar>): Ditto.

  • runtime/SamplingProfiler.cpp:

(JSC::SamplingProfiler::reportTopFunctions): Use auto for the result of makeString.
(JSC::SamplingProfiler::reportTopBytecodes): Ditto.

  • runtime/TypeProfiler.cpp:

(JSC::TypeProfiler::typeInformationForExpressionAtOffset): Use append instead of
appendLiteral.

  • runtime/TypeSet.cpp:

(JSC::TypeSet::dumpTypes const): Use append instead of appendLiteral.
(JSC::TypeSet::toJSONString const): Ditto.
(JSC::StructureShape::propertyHash): Ditto.
(JSC::StructureShape::toJSONString const): Ditto.

Source/WebCore:

  • Modules/fetch/FetchBodyConsumer.cpp:

(WebCore::packageFormData): Use auto for the result of makeString.

  • Modules/indexeddb/IDBKeyData.cpp:

(WebCore::IDBKeyData::loggingString const): Use append instead
of appendLiteral.

  • Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:

(WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Use auto
for the result of makeString.

  • Modules/indexeddb/server/SQLiteIDBCursor.cpp:

(WebCore::IDBServer::buildPreIndexStatement): Use makeString
instead of StringBuilder.
(WebCore::IDBServer::buildIndexStatement): Ditto.
(WebCore::IDBServer::buildObjectStoreStatement): Ditto.

  • Modules/websockets/WebSocket.cpp:

(WebCore::encodeProtocolString): Use append instead of appendLiteral.

  • Modules/websockets/WebSocketExtensionDispatcher.cpp:

(WebCore::WebSocketExtensionDispatcher::appendAcceptedExtension): Ditto.

  • Modules/websockets/WebSocketHandshake.cpp:

(WebCore::WebSocketHandshake::clientHandshakeMessage const): Use
makeString instead of StringBuilder.
(WebCore::WebSocketHandshake::clientHandshakeRequest const): Tweak
to match the function above more closely, and use ASCIILiteral.

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(formatForDebugger): Use makeString instead of StringBuilder.

  • contentextensions/CombinedURLFilters.cpp:

(WebCore::ContentExtensions::prefixTreeVertexToString): Use
append instead of appendLiteral.

  • css/CSSBasicShapes.cpp:

(WebCore::buildCircleString): Ditto.
(WebCore::buildEllipseString): Ditto.
(WebCore::buildPathString): Ditto.
(WebCore::buildPolygonString): Ditto.
(WebCore::buildInsetString): Ditto.

  • css/CSSGradientValue.cpp:

(WebCore::CSSLinearGradientValue::customCSSText const): Ditto.
(WebCore::CSSRadialGradientValue::customCSSText const): Ditto.
(WebCore::CSSConicGradientValue::customCSSText const): Ditto.

  • css/CSSGridIntegerRepeatValue.cpp:

(WebCore::CSSGridIntegerRepeatValue::customCSSText const):
Use makeString instead of StringBuilder.

  • css/CSSImageSetValue.cpp:

(WebCore::CSSImageSetValue::customCSSText const): Use append
instead of appendLiteral.

  • css/CSSImportRule.cpp:

(WebCore::CSSImportRule::cssText const): Use makeString instead
of StringBuilder.

  • css/CSSKeyframeRule.cpp:

(WebCore::StyleRuleKeyframe::cssText const): Ditto.

  • css/CSSKeyframesRule.cpp:

(WebCore::CSSKeyframesRule::cssText const): Use variadic append.

  • css/CSSLineBoxContainValue.cpp:

(WebCore::CSSLineBoxContainValue::customCSSText const): Use
append instead of appendLiteral.

  • css/CSSNamespaceRule.cpp:

(WebCore::CSSNamespaceRule::cssText const): Ditto.

  • css/CSSPageRule.cpp:

(WebCore::CSSPageRule::cssText const): Use makeString instead of
StringBuilder.

  • css/CSSPaintImageValue.cpp:

(WebCore::CSSPaintImageValue::customCSSText const): Ditto.

  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
Use append instead of appendLiteral.

  • css/CSSSelector.cpp:

(WebCore::appendLangArgumentList): Use variadic append.
(WebCore::CSSSelector::selectorText const): Ditto. Also use
append instead of appendLiteral and make some improvements to
cut down on allocations a little.

  • css/CSSSelectorList.cpp:

(WebCore::CSSSelectorList::buildSelectorsText const): Use
append instead of appendLiteral.

  • css/CSSStyleSheet.cpp:

(WebCore::CSSStyleSheet::CSSStyleSheet): Moved more of the
data member initialization to the class definition.
(WebCore::CSSStyleSheet::addRule): Use makeString instead of
StringBuilder.

  • css/CSSStyleSheet.h: Moved initialization here.
  • css/CSSTimingFunctionValue.cpp:

(WebCore::CSSStepsTimingFunctionValue::customCSSText const):
Use makeString instead of StringBuilder.
(WebCore::CSSSpringTimingFunctionValue::customCSSText const):
Ditto.

  • css/MediaList.cpp:

(WebCore::MediaQuerySet::mediaText const): Use append instead
of appendLiteral.

  • css/MediaQuery.cpp:

(WebCore::MediaQuery::serialize const): Ditto.

  • css/MediaQueryExpression.cpp:

(WebCore::MediaQueryExpression::serialize const): Use makeString
instead of StringBuilder.

  • css/StyleProperties.cpp:

(WebCore::StyleProperties::getLayeredShorthandValue const):
Use append instead of appendLiteral.

  • css/parser/CSSParserToken.cpp:

(WebCore::CSSParserToken::serialize const): Removed a lot of
unnecessary braces. Use variadic append and append instead of appendLiteral.

  • dom/Document.cpp:

(WebCore::Document::initSecurityContext): Use auto for the result
of makeString.

  • dom/Element.cpp:

(WebCore::appendAttributes): Use variadic append and append
instead of appendLiteral.

  • dom/SecurityContext.cpp:

(WebCore::SecurityContext::parseSandboxPolicy): Ditto.

  • editing/HTMLInterchange.cpp:

(WebCore::convertHTMLTextToInterchangeFormat): Ditto.

  • editing/TextIterator.cpp:

(WebCore::createSearcher): Use auto for the result of makeString.

  • editing/markup.cpp:

(WebCore::StyledMarkupAccumulator::appendStyleNodeOpenTag):
Use append instead of appendLiteral.
(WebCore::StyledMarkupAccumulator::appendStartTag): Ditto.
(WebCore::urlToMarkup): Ditto.

  • html/FormController.cpp:

(WebCore::recordFormStructure): Ditto.

  • html/HTMLFormControlElement.cpp:

(WebCore::HTMLFormControlElement::reportValidity): Use auto for
the result of makeString.

  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::validateInteractively): Ditto.

  • html/HTMLImageElement.cpp:

(WebCore::HTMLImageElement::completeURLsInAttributeValue const):
Use append insteaed of appendLiteral.

  • html/MediaElementSession.cpp:

(WebCore::restrictionNames): Use auto for the result of makeString.

  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::getUniformLocation): Ditto.

  • html/parser/HTMLTreeBuilder.cpp:

(WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemaining): Ditto.

  • html/parser/XSSAuditorDelegate.cpp:

(WebCore::buildConsoleError): Use makeString instead of StringBuilder.

  • html/track/TextTrackCue.cpp:

(WebCore::TextTrackCue::rebuildDisplayTree): Ditto.

  • inspector/InspectorFrontendAPIDispatcher.cpp:

(WebCore::expressionForEvaluatingCommand): Use append instead of appendLiteral.

  • inspector/InspectorOverlay.cpp:

(WebCore::InspectorOverlay::drawElementTitle): Use auto for the result of makeString.

  • inspector/InspectorStyleSheet.cpp:

(WebCore::InspectorStyleSheet::addRule): Use append instead of appendLiteral.

  • inspector/agents/InspectorApplicationCacheAgent.cpp:

(WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource):
Use makeString instead of StringBuilder.

  • inspector/agents/WebConsoleAgent.cpp:

(WebCore::WebConsoleAgent::didReceiveResponse): Use auto for the result of makeString.
(WebCore::WebConsoleAgent::didFailLoading): Ditto.

  • loader/MixedContentChecker.cpp:

(WebCore::logWarning): Ditto
(WebCore::MixedContentChecker::checkFormForMixedContent): Ditto

  • loader/PrivateClickMeasurement.cpp:

(WebCore::makeValidURL): Added. Used for various cases below that all construct
URLs in the same way with the same kinds of checks. Use makeString here instead
of StringBuilder.
(WebCore::attributionReportURL): Call makeValidURL.
(WebCore::PrivateClickMeasurement::tokenSignatureURL const): Ditto.
(WebCore::PrivateClickMeasurement::tokenPublicKeyURL const): Ditto.

  • loader/ResourceLoadStatistics.cpp:

(WebCore::appendBoolean): Use append instead of appendLiteral.
(WebCore::appendHashSet): Ditto.
(WebCore::appendNavigatorAPIOptionSet): Ditto.
(WebCore::appendScreenAPIOptionSet): Ditto.
(WebCore::ResourceLoadStatistics::toString const): Ditto.

  • loader/WorkerThreadableLoader.cpp:

(WebCore::WorkerThreadableLoader::loadResourceSynchronously): Use auto for
the result of makeString.

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::postMessage): Ditto.

  • page/Frame.cpp:

(WebCore::createRegExpForLabels): Use append instead of appendLiteral.
Also tweak coding style a bit.

  • page/FrameView.cpp:

(WebCore::FrameView::logMockScrollAnimatorMessage const): Use makeString
instead of StringBuilder.

  • page/PageSerializer.cpp:

(WebCore::PageSerializer::SerializerMarkupAccumulator::appendStartTag):
Use append instead of appendLiteral.
(WebCore::PageSerializer::serializeCSSStyleSheet): Ditto.
(WebCore::PageSerializer::urlForBlankFrame): Use auto for the result of
makeString.

  • page/PerformanceLoggingClient.cpp:

(WebCore::PerformanceLoggingClient::synchronousScrollingReasonsAsString):
Use makeString instead of StringBuilder.

  • page/cocoa/ResourceUsageOverlayCocoa.mm:

(WebCore::ResourceUsageOverlay::platformDraw): Use auto for the result of
makeString.

  • page/csp/ContentSecurityPolicy.cpp:

(WebCore::consoleMessageForViolation): Use makeString instsead of StringBuilder.
(WebCore::ContentSecurityPolicy::allowRunningOrDisplayingInsecureContent): Ditto.
(WebCore::ContentSecurityPolicy::reportInvalidDirectiveValueCharacter const):
Get rid of local variable for result of makeString.
(WebCore::ContentSecurityPolicy::reportInvalidPathCharacter const): Ditto.
(WebCore::ContentSecurityPolicy::reportInvalidSourceExpression const): Ditto.

  • page/csp/ContentSecurityPolicyDirectiveList.cpp:

(WebCore::ContentSecurityPolicyDirectiveList::create): Get rid of local
variable for result of makeString.

  • page/scrolling/ScrollingCoordinator.cpp:

(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
Use makeString instead of StringBulder.

  • platform/Decimal.cpp:

(WebCore::Decimal::toString const): Use append instead of appendLiteral.

  • platform/animation/TimingFunction.cpp:

(WebCore::TimingFunction::createFromCSSText): Use makeString instead
of StringBuilder.

  • platform/audio/HRTFElevation.cpp:

(WebCore::HRTFElevation::calculateKernelsForAzimuthElevation): Use auto
for the result of makeString.

  • platform/glib/UserAgentGLib.cpp:

(WebCore::buildUserAgentString): Use append instead of appendLiteral.

  • platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:

(WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Use
append instead of appendLiteral.

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::recursiveCommitChanges): Got rid of local
variable for result of makeString.
(WebCore::GraphicsLayerCA::appendToUncommittedAnimations): Use auto
for result of makeString.

  • platform/graphics/ca/TileController.cpp:

(WebCore::TileController::tileRevalidationTimerFired): Update to
use OptionSet.

  • platform/graphics/ca/TileGrid.cpp:

(WebCore::validationPolicyAsString): Use OptionSet.
(WebCore::TileGrid::setNeedsDisplayInRect): Use auto for iterator
and range-based for loop.
(WebCore::TileGrid::updateTileLayerProperties): Ditto.
(WebCore::TileGrid::blankPixelCount const): Ditto.
(WebCore::TileGrid::removeTiles): Use HashCountedSet.
(WebCore::TileGrid::revalidateTiles): Use OptionSet.
(WebCore::TileGrid::retainedTileBackingStoreMemory const): Use
ranged-based for loop.
(WebCore::TileGrid::drawTileMapContents const): Use range-based
for loop and use writeIntegerToBuffer instead of String::number.
(WebCore::TileGrid::platformCALayerRepaintCount const): Use
HashCountedSet.
(WebCore::TileGrid::platformCALayerIncrementRepaintCount): Ditto.
This cuts us down from 3 hash table lookups to 1.
(WebCore::TileGrid::removeUnparentedTilesNow): Removed local
variable to make code a little tighter.

  • platform/graphics/ca/TileGrid.h: Use OptionSet and HashCountedSet.

Removed some type names.

  • platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:

(WebCore::PlatformCAFilters::setFiltersOnLayer): Use auto for
reuslt of makeString.

  • platform/mock/MockRealtimeVideoSource.cpp:

(WebCore::MockRealtimeVideoSource::drawText): Ditto.

  • platform/mock/ScrollAnimatorMock.cpp:

(WebCore::ScrollAnimatorMock::scrollbarPrefix const): Added
helper function for use below.
(WebCore::ScrollAnimatorMock::mouseEnteredScrollbar const): Use
makeString instead of StringBuilder.
(WebCore::ScrollAnimatorMock::mouseExitedScrollbar const): Ditto.
(WebCore::ScrollAnimatorMock::mouseIsDownInScrollbar const): Ditto.

  • platform/mock/ScrollAnimatorMock.h: Ditto.
  • platform/network/ProxyServer.cpp:

(WebCore::appendProxyServerString): Use append instead of appendLiteral.
(WebCore::toString): Ditto.

  • platform/network/ResourceResponseBase.cpp:

(WebCore::ResourceResponseBase::sanitizeSuggestedFilename): Get rid
of local variable with result of maekString in it.

  • platform/playstation/UserAgentPlayStation.cpp:

(WebCore::platformForUAString): Deleted. No need for a global variable
to hold the result of something called only once.
(WebCore::platformVersionForUAString): Ditto.
(WebCore::buildUserAgentString): Deleted.
(WebCore::standardUserAgentStatic): Moved the logic from buildUserAgentString
here, using makeString instead of StringBuilder.

  • platform/sql/SQLiteDatabase.cpp:

(WebCore::SQLiteDatabase::open): Use auto for result of makeString.

  • platform/sql/SQLiteFileSystem.cpp:

(WebCore::SQLiteFileSystem::deleteDatabaseFile): Ditto.

  • platform/text/DateTimeFormat.cpp:

(WebCore::DateTimeFormat::quoteAndAppendLiteral): Use append instead
of appendLiteral and StringView::substring instead of String::substring.

  • platform/win/ClipboardUtilitiesWin.cpp:

(WebCore::replaceNewlinesWithWindowsStyleNewlines): Use append
instead of appendLiteral.

  • platform/win/UserAgentWin.cpp:

(WebCore::standardUserAgent): Use makeString instead of StringBuildeer.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::name const): Ditto.
(WebCore::RenderLayer::debugDescription const): Ditto.

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::logLayerInfo): Use append instead of
appendLiteral.

  • rendering/RenderTreeAsText.cpp:

(WebCore::quoteAndEscapeNonPrintables): Ditto.
(WebCore::nodePosition): Ditto.

  • svg/SVGPathStringBuilder.cpp:

(WebCore::SVGPathStringBuilder::moveTo): Ditto.
(WebCore::SVGPathStringBuilder::lineTo): Ditto.
(WebCore::SVGPathStringBuilder::lineToHorizontal): Ditto.
(WebCore::SVGPathStringBuilder::lineToVertical): Ditto.
(WebCore::SVGPathStringBuilder::curveToCubic): Ditto.
(WebCore::SVGPathStringBuilder::curveToCubicSmooth): Ditto.
(WebCore::SVGPathStringBuilder::curveToQuadratic): Ditto.
(WebCore::SVGPathStringBuilder::curveToQuadraticSmooth): Ditto.
(WebCore::SVGPathStringBuilder::arcTo): Ditto.
(WebCore::SVGPathStringBuilder::closePath): Ditto.

  • testing/Internals.cpp:

(WebCore::Internals::dumpMarkerRects): Ditto.
(WebCore::appendOffsets):
(WebCore::Internals::scrollSnapOffsets): Ditto.

  • workers/WorkerScriptLoader.cpp:

(WebCore::WorkerScriptLoader::validateWorkerResponse): Use auto
for reuslt of makeString.

Source/WebKit:

  • NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:

(WebKit::ResourceLoadStatisticsDatabaseStore::ensureAndMakeDomainList): Use append
instead of appendLiteral.
(WebKit::domainsToString): Ditto.
(WebKit::buildList): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics): Ditto.
(WebKit::appendBoolean): Ditto.
(WebKit::appendNextEntry): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): Ditto.
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): Ditto.

  • NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:

(WebKit::ResourceLoadStatisticsMemoryStore::dumpResourceLoadStatistics): Ditto.

  • NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: Ditto.

(WebKit::domainsToString): Ditto.

  • NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:

(WebKit::WebResourceLoadStatisticsStore::create): Moved this here from the header.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::toString const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::encode const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::decode): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyDataForSpecificFirstParty::operator== const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::toString const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::encode const): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::decode): Ditto.
(WebKit::WebResourceLoadStatisticsStore::ThirdPartyData::operator< const): Ditto.

  • NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: Moved member

functions of the nested structures into the implementation file and fixed
the indentation of the structures to indicate the nesting.

  • NetworkProcess/NetworkLoadChecker.cpp:

(WebKit::NetworkLoadChecker::continueCheckingRequest): Do not use a local
variable for the reuslt of makeString.

  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::newTestingSession): Ditto.

  • NetworkProcess/cache/NetworkCache.cpp:

(WebKit::NetworkCache::Cache::dumpContentsToFile): Use append instead of appendLiteral

  • NetworkProcess/cache/NetworkCacheEntry.cpp:

(WebKit::NetworkCache::Entry::asJSON const): Ditto.

  • NetworkProcess/cache/NetworkCacheStorage.cpp:

(WebKit::NetworkCache::makeVersionedDirectoryPath): Do not use a local variable for
the result of makeString.

  • NetworkProcess/soup/NetworkProcessSoup.cpp:

(WebKit::buildAcceptLanguages): Use append instead of appendLiteral.

  • NetworkProcess/soup/WebSocketTaskSoup.cpp:

(WebKit::WebSocketTask::acceptedExtensions const): Ditto.

  • NetworkProcess/webrtc/NetworkMDNSRegister.cpp:

(WebKit::NetworkMDNSRegister::registerMDNSName): Use auto for the result of makeString.

  • Shared/WebMemorySampler.cpp:

(WebKit::WebMemorySampler::writeHeaders): Ditto.

  • Shared/mac/AuxiliaryProcessMac.mm:

(WebKit::initializeSandboxParameters): Do not use a local variable for the result of
makeString. Also, take advantage of the support for concatenating an NSString instead
of converting it to a WTF::String.

  • Shared/mac/WebMemorySampler.mac.mm:

(WebKit::WebMemorySampler::sampleWebKit const): Use ASCIILiteral and remove explicit
conversion to String.

  • UIProcess/API/glib/WebKitWebView.cpp:

(webkitWebViewRunJavaScriptCallback): Use append instead of appendLiteral.

  • UIProcess/Automation/WebAutomationSession.cpp:

(WebKit::fileCanBeAcceptedForUpload): Use auto for result of makeString.

  • WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: Use makeString instead of

StringBuilder.

  • UIProcess/Network/NetworkProcessProxy.cpp:

(WebKit::NetworkProcessProxy::requestStorageSpace): Use auto for result of makeString.

  • UIProcess/WebBackForwardList.cpp:

(WebKit::WebBackForwardList::loggingString): Use append instead of appendLiteral.

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::processDidFinishLaunching): Use auto for result of makeString.
(WebKit::WebProcessPool::startMemorySampler): Ditto.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::dumpHistoryItem): Use append instead of appendLiteral.
(WebKit::WebPage::getContentsAsString): Ditto.

Source/WebKitLegacy:

  • WebCoreSupport/NetworkStorageSessionMap.cpp:

(NetworkStorageSessionMap::switchToNewTestingSession): Do not use local
for return value of makeString.

Source/WebKitLegacy/mac:

  • WebView/WebHTMLRepresentation.mm:

(regExpForLabels): Use append instead of appendLiteral.
Also imrpove local variable names a bit.

Source/WebKitLegacy/win:

  • AccessibleBase.cpp:

(AccessibleBase::get_accKeyboardShortcut): Use append instead of appnedLiteral.

  • WebView.cpp: Ditto.

Source/WTF:

The optimization done by appendLiteral has minimal value and is something we
can do without. It does not cut down the number of allocations, which is the
main cost of the StringBuilder class. Getting rid of the differently named
appendLiteral improves the design of the StringBuilder class for callers.
Our goal is to get as close as possible to a single append function.

If we decide we need an optimization for literals, we can come up with a
different way that is compatible with append. For example, we could assume
that any char array is a literal and check that at compile time in
StringConcatenate; that optimization would work for both makeString and
StringBuilder. Or we could use a strategy like ASCIILiteral.

  • wtf/FileSystem.cpp:

(WTF::FileSystemImpl::encodeForFileName): Streamline logic,
and use variadic append to make this more efficient.

  • wtf/JSONValues.cpp:

(WTF::JSONImpl::Value::escapeString): Use append instead
of appendLiteral.
(WTF::JSONImpl::Value::writeJSON const): Ditto.

  • wtf/Logger.h:

(WTF::Logger::log): Use auto for result of makeString.
(WTF::Logger::logVerbose): Ditto.

  • wtf/MediaTime.cpp:

(WTF::MediaTime::toString const): Use makeString instead of StringBuilder.

  • wtf/text/IntegerToStringConversion.h:

Made lengthOfIntegerAsString a constexpr function so we can use it to
compute the required size of arrays for conversion. Added using for both
lengthOfIntegerAsString and writeIntegerToBuffer so we can use them without
the WTF prefix as is customary for functions in WTF.

  • wtf/text/StringBuilder.h:

(WTF::StringBuilder::appendLiteral): Deleted.

  • wtf/text/StringConcatenate.h: Added support for appending StringImpl&,

StringImpl*, AtomStringImpl&, and AtomStringImpl*.

Tools:

  • TestWebKitAPI/Tests/WTF/StringBuilder.cpp:

Use append instead of appendLiteral.

  • TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:

(TestWebKitAPI::createCommand): Use makeString instead of StringBuilder.

  • TestWebKitAPI/Tests/WebCore/Logging.cpp:

(TestWebKitAPI::TEST_F): Made lots of fixes to code inside #if TEST_OUTPUT,
which hasn't compiled in a long time. Still not 100% there, but closer.

  • TestWebKitAPI/Tests/WebCore/TextCodec.cpp:

(TestWebKitAPI::testDecode): Use append instead of appendLiteral.

  • WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:

(WTR::AccessibilityUIElement::helpText const): Ditto.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSGradientValue.cpp

    r276203 r277967  
    697697    } else if (gradientType() == CSSPrefixedLinearGradient) {
    698698        if (isRepeating())
    699             result.appendLiteral("-webkit-repeating-linear-gradient(");
     699            result.append("-webkit-repeating-linear-gradient(");
    700700        else
    701             result.appendLiteral("-webkit-linear-gradient(");
     701            result.append("-webkit-linear-gradient(");
    702702
    703703        if (m_angle)
     
    707707
    708708        for (auto& stop : stops()) {
    709             result.appendLiteral(", ");
     709            result.append(", ");
    710710            writeColorStop(result, stop);
    711711        }
    712712    } else {
    713713        if (isRepeating())
    714             result.appendLiteral("repeating-linear-gradient(");
     714            result.append("repeating-linear-gradient(");
    715715        else
    716             result.appendLiteral("linear-gradient(");
     716            result.append("linear-gradient(");
    717717
    718718        bool wroteSomething = false;
     
    722722            wroteSomething = true;
    723723        } else if (firstX() || (firstY() && firstY()->valueID() != CSSValueBottom)) {
    724             result.appendLiteral("to ");
     724            result.append("to ");
    725725            appendSpaceSeparatedOptionalCSSPtrText(result, firstX(), firstY());
    726726            wroteSomething = true;
     
    729729        for (auto& stop : stops()) {
    730730            if (wroteSomething)
    731                 result.appendLiteral(", ");
     731                result.append(", ");
    732732            wroteSomething = true;
    733733            writeColorStop(result, stop);
     
    892892    } else if (gradientType() == CSSPrefixedRadialGradient) {
    893893        if (isRepeating())
    894             result.appendLiteral("-webkit-repeating-radial-gradient(");
     894            result.append("-webkit-repeating-radial-gradient(");
    895895        else
    896             result.appendLiteral("-webkit-radial-gradient(");
     896            result.append("-webkit-radial-gradient(");
    897897
    898898        if (firstX() || firstY())
    899899            appendSpaceSeparatedOptionalCSSPtrText(result, firstX(), firstY());
    900900        else
    901             result.appendLiteral("center");
     901            result.append("center");
    902902
    903903        if (m_shape || m_sizingBehavior) {
    904             result.appendLiteral(", ");
     904            result.append(", ");
    905905            if (m_shape)
    906906                result.append(m_shape->cssText(), ' ');
    907907            else
    908                 result.appendLiteral("ellipse ");
     908                result.append("ellipse ");
    909909            if (m_sizingBehavior)
    910910                result.append(m_sizingBehavior->cssText());
    911911            else
    912                 result.appendLiteral("cover");
     912                result.append("cover");
    913913        } else if (m_endHorizontalSize && m_endVerticalSize)
    914914            result.append(", ", m_endHorizontalSize->cssText(), ' ', m_endVerticalSize->cssText());
    915915
    916916        for (auto& stop : stops()) {
    917             result.appendLiteral(", ");
     917            result.append(", ");
    918918            writeColorStop(result, stop);
    919919        }
    920920    } else {
    921921        if (isRepeating())
    922             result.appendLiteral("repeating-radial-gradient(");
     922            result.append("repeating-radial-gradient(");
    923923        else
    924             result.appendLiteral("radial-gradient(");
     924            result.append("radial-gradient(");
    925925
    926926        bool wroteSomething = false;
     
    929929        // is when a sizing keyword is used (or all sizing is omitted).
    930930        if (m_shape && m_shape->valueID() != CSSValueEllipse && (m_sizingBehavior || (!m_sizingBehavior && !m_endHorizontalSize))) {
    931             result.appendLiteral("circle");
     931            result.append("circle");
    932932            wroteSomething = true;
    933933        }
     
    950950            if (wroteSomething)
    951951                result.append(' ');
    952             result.appendLiteral("at ");
     952            result.append("at ");
    953953            appendSpaceSeparatedOptionalCSSPtrText(result, firstX(), firstY());
    954954            wroteSomething = true;
     
    956956
    957957        if (wroteSomething)
    958             result.appendLiteral(", ");
     958            result.append(", ");
    959959
    960960        bool wroteFirstStop = false;
    961961        for (auto& stop : stops()) {
    962962            if (wroteFirstStop)
    963                 result.appendLiteral(", ");
     963                result.append(", ");
    964964            wroteFirstStop = true;
    965965            writeColorStop(result, stop);
     
    12201220    StringBuilder result;
    12211221
    1222     if (isRepeating())
    1223         result.appendLiteral("repeating-conic-gradient(");
    1224     else
    1225         result.appendLiteral("conic-gradient(");
     1222    result.append(isRepeating() ? "repeating-conic-gradient(" : "conic-gradient(");
    12261223
    12271224    bool wroteSomething = false;
     
    12351232        if (wroteSomething)
    12361233            result.append(' ');
    1237         result.appendLiteral("at ");
     1234        result.append("at ");
    12381235        appendSpaceSeparatedOptionalCSSPtrText(result, firstX(), firstY());
    12391236        wroteSomething = true;
     
    12411238
    12421239    if (wroteSomething)
    1243         result.appendLiteral(", ");
     1240        result.append(", ");
    12441241
    12451242    bool wroteFirstStop = false;
    12461243    for (auto& stop : stops()) {
    12471244        if (wroteFirstStop)
    1248             result.appendLiteral(", ");
     1245            result.append(", ");
    12491246        wroteFirstStop = true;
    12501247        writeColorStop(result, stop);
Note: See TracChangeset for help on using the changeset viewer.