Using StringView.split() instead of String.split() in some places
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2017 22:51:40 +0000 (22:51 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2017 22:51:40 +0000 (22:51 +0000)
commitdba187973b8ebd883b5eb56f8729a330ab0bd361
tree5a518f7ab904aae20a36b62d4453967a23dddefd
parentc729519fadce53bf0d1c53d5a01d00fc6cb9743d
Using StringView.split() instead of String.split() in some places
https://bugs.webkit.org/show_bug.cgi?id=170925

Reviewed by Darin Adler.

Source/WebCore:

Replace some uses of String.split() with StringView.split() (added in r211087) as the latter
avoids the need to allocate an intermediary Vector of substrings. Instead StringView.split()
returns an iterator for traversing the substrings.

No functionality changed. So, no new tests.

* accessibility/AccessibilityObject.cpp: Convert some typedefs to modern C++ using declarations.
(WebCore::ASCIICaseInsensitiveStringViewHashTranslator::hash): Added.
(WebCore::ASCIICaseInsensitiveStringViewHashTranslator::equal): Added.
(WebCore::AccessibilityObject::ariaRoleToWebCoreRole): Modified code to use StringView.split().
(WebCore::AccessibilityObject::elementsFromAttribute): Ditto.
* dom/TreeScope.cpp:
(WebCore::TreeScope::getElementById): Added.
* dom/TreeScope.h:
* html/LinkRelAttribute.cpp:
(WebCore::LinkRelAttribute::LinkRelAttribute): Modified code to use StringView.split().
* html/parser/XSSAuditor.cpp:
(WebCore::semicolonSeparatedValueContainsJavaScriptURL): Ditto.
* platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
(WebCore::CDMPrivateMediaSourceAVFObjC::createSession): Ditto.
* platform/network/CacheValidation.cpp:
(WebCore::collectVaryingRequestHeaders): Simplify code by using the String.split(UChar, Vector<String>&) overload.
* svg/SVGAnimationElement.cpp:
(WebCore::parseKeyTimes): Modified code to use StringView.split().
* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Ditto.
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Ditto.
(WebCore::Internals::setMediaElementRestrictions): Ditto.
(WebCore::Internals::setAudioContextRestrictions): Ditto.
(WebCore::Internals::setPageMuted): Ditto.
* testing/Internals.h:

Source/WTF:

Add HashMap::get() overload that takes a HashTranslator.

* wtf/HashMap.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/HashMap.h
Source/WTF/wtf/text/StringHash.h
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/dom/TreeScope.cpp
Source/WebCore/dom/TreeScope.h
Source/WebCore/html/LinkRelAttribute.cpp
Source/WebCore/html/parser/XSSAuditor.cpp
Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/network/CacheValidation.cpp
Source/WebCore/svg/SVGAnimationElement.cpp
Source/WebCore/svg/SVGToOTFFontConversion.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h