Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Issue 2148423003: Use StringView for equalIgnoringCase. (Closed)

Created:
4 years, 5 months ago by esprehn
Modified:
4 years, 4 months ago
CC:
blink-reviews, blink-reviews-html_chromium.org, blink-reviews-wtf_chromium.org, chromium-reviews, dglazkov+blink, kinuko+watch, Mikhail
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use StringView for equalIgnoringCase. This lets us merge the code paths and simplifies the code a bunch. In doing this I removed the ASCII fast path that was in the equalsIgnoringCase(const StringImpl*, const LChar*) function, though curiously it wasn't in the (const UChar*, const LChar*) one, but that function is also used a lot less often. Lets try removing this ancient fast path for now (from 2006 with no comments about why it exists [1]) and instead opt for simpler code. For comparing LChar strings the new path should be just as fast if not faster. For comparing LChar to UChar strings we end up doing a foldCase call which will be slower, but we should see how bad it is first. Long term almost all callers of equalIgnoringCase need to switch to equalIgnoringASCIICase anyway since that's what the specs require (and what Webkit does now), which will put this fast path back in place. We can also add the fast path back in the (LChar, UChar) path if needed. Switching all of the callers over to the new StringView version of equalIgnoringCase also exposed that the CSP parsing logic was accidentally using the function incorrectly and doing prefix matches instead of actually comparing to the expected values as described in issue 634217. This patches fixes that mistake. [1] https://chromium.googlesource.com/chromium/src/+/6f022a05a21fc5ed091d7bcb6b81104ea2afdf8e BUG=615174, 634217 Committed: https://crrev.com/9a8e5154f97acb2d9ccdee61e464e0d2b33b100e Cr-Commit-Position: refs/heads/master@{#409987}

Patch Set 1 #

Patch Set 2 : Fix CSPSourceList::parseNonce. #

Patch Set 3 : fix. #

Patch Set 4 : fix. #

Total comments: 3

Patch Set 5 : add rebaselines. #

Total comments: 7

Patch Set 6 : Add back ptr compare step. #

Total comments: 1

Patch Set 7 : DCHECK is silly. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+100 lines, -147 lines) Patch
M third_party/WebKit/LayoutTests/TestExpectations View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp View 1 2 3 4 2 chunks +12 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/CSPSourceList.cpp View 1 2 3 4 5 chunks +17 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/weborigin/KURL.h View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/AtomicString.h View 1 chunk +0 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringHash.h View 1 2 3 4 5 1 chunk +6 lines, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/text/StringImpl.h View 1 2 3 4 5 1 chunk +4 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringImpl.cpp View 1 2 3 4 5 6 3 chunks +11 lines, -87 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringView.h View 1 2 3 4 5 chunks +23 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringView.cpp View 1 2 3 4 5 2 chunks +23 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/WTFString.h View 1 2 3 4 5 2 chunks +0 lines, -7 lines 0 comments Download

Messages

Total messages: 47 (35 generated)
esprehn
https://codereview.chromium.org/2148423003/diff/60001/third_party/WebKit/Source/wtf/text/StringImpl.cpp File third_party/WebKit/Source/wtf/text/StringImpl.cpp (left): https://codereview.chromium.org/2148423003/diff/60001/third_party/WebKit/Source/wtf/text/StringImpl.cpp#oldcode2103 third_party/WebKit/Source/wtf/text/StringImpl.cpp:2103: equal = equal && (toASCIILower(ac) == toASCIILower(bc)); We lose ...
4 years, 4 months ago (2016-08-04 08:43:06 UTC) #27
haraken
LGTM https://codereview.chromium.org/2148423003/diff/80001/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp File third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp (right): https://codereview.chromium.org/2148423003/diff/80001/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp#newcode95 third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp:95: return equalIgnoringCaseAndNullity(*token.data().impl(), *SVGNames::foreignObjectTag.localName().impl()); Honestly speaking, I'm not sure ...
4 years, 4 months ago (2016-08-04 09:05:28 UTC) #29
Mike West
Whoops! Thank for for catching this error, esprehn@. The fix LGTM.
4 years, 4 months ago (2016-08-04 11:20:40 UTC) #30
esprehn
https://codereview.chromium.org/2148423003/diff/80001/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp File third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp (right): https://codereview.chromium.org/2148423003/diff/80001/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp#newcode95 third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp:95: return equalIgnoringCaseAndNullity(*token.data().impl(), *SVGNames::foreignObjectTag.localName().impl()); On 2016/08/04 at 09:05:28, haraken wrote: ...
4 years, 4 months ago (2016-08-04 18:30:08 UTC) #31
esprehn
https://codereview.chromium.org/2148423003/diff/80001/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp File third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp (right): https://codereview.chromium.org/2148423003/diff/80001/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp#newcode95 third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp:95: return equalIgnoringCaseAndNullity(*token.data().impl(), *SVGNames::foreignObjectTag.localName().impl()); I removed this optimization but left ...
4 years, 4 months ago (2016-08-04 21:57:19 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2148423003/100001
4 years, 4 months ago (2016-08-04 21:58:05 UTC) #35
commit-bot: I haz the power
Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-generic_chromium_compile_only_ng/builds/178381) linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, ...
4 years, 4 months ago (2016-08-04 22:10:31 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2148423003/120001
4 years, 4 months ago (2016-08-04 22:40:05 UTC) #40
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/116599)
4 years, 4 months ago (2016-08-04 23:56:49 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2148423003/120001
4 years, 4 months ago (2016-08-05 00:19:07 UTC) #44
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 4 months ago (2016-08-05 04:01:26 UTC) #45
commit-bot: I haz the power
4 years, 4 months ago (2016-08-05 04:03:33 UTC) #47
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/9a8e5154f97acb2d9ccdee61e464e0d2b33b100e
Cr-Commit-Position: refs/heads/master@{#409987}

Powered by Google App Engine
This is Rietveld 408576698