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

Issue 2024373002: Replace CSSParserString with StringView. (Closed)

Created:
4 years, 6 months ago by esprehn
Modified:
4 years, 6 months ago
Reviewers:
haraken, Timothy Loh
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-wtf_chromium.org, chromium-reviews, dglazkov+blink, kenneth.christiansen, Mikhail, rwlbuis, Yoav Weiss
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Replace CSSParserString with StringView. This removes the special string type the parser was using in favor of StringView. In doing so it also makes all of the string allocations inside the parser more explicit. Doing this requires adding equalIgnoringASCIICase for StringView, and also operator[], tests are included. :) One major change is now StringView::toString() will attempt to create an 8bit string from a 16bit StringView whenever possible. This does mean potentially wasted work inside StringImpl::create8BitIfPossible if callers are frequently making strings with unicode characters in them. We should see how often this happens in practice, and probably optimize the code in create8BitIfPossible to first scan the string to avoid the wasted malloc. BUG=615174 Committed: https://crrev.com/e3c7c11bf601fc6ffbea29ac7fd02b42c283840a Cr-Commit-Position: refs/heads/master@{#397094}

Patch Set 1 #

Total comments: 4

Patch Set 2 : Make StringView::toString() vend 8bit strings if possible. #

Patch Set 3 : Match semantics for equalStringView and equalIgnoringASCIICase to String. #

Patch Set 4 : Match arguments to equalStringView. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+237 lines, -284 lines) Patch
M third_party/WebKit/Source/core/css/CSSVariableData.cpp View 3 chunks +5 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/css/cssom/CSSKeywordValue.cpp View 2 chunks +1 line, -4 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSAtRuleID.h View 2 chunks +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSAtRuleID.cpp View 1 chunk +12 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParser.cpp View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp View 3 chunks +2 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp View 8 chunks +10 lines, -10 lines 0 comments Download
D third_party/WebKit/Source/core/css/parser/CSSParserString.h View 1 chunk +0 lines, -110 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParserToken.h View 4 chunks +14 lines, -16 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp View 5 chunks +15 lines, -15 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParserTokenTest.cpp View 1 chunk +2 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp View 13 chunks +13 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp View 5 chunks +7 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp View 8 chunks +11 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSTokenizer.h View 5 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp View 7 chunks +9 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h View 2 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp View 2 chunks +2 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp View 4 chunks +10 lines, -17 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSVariableParser.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/parser/MediaQueryParser.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringView.h View 1 2 3 4 chunks +20 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringView.cpp View 1 2 3 2 chunks +19 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringViewTest.cpp View 1 2 2 chunks +67 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (13 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2024373002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2024373002/1
4 years, 6 months ago (2016-06-01 04:43:43 UTC) #2
esprehn
4 years, 6 months ago (2016-06-01 05:19:20 UTC) #5
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2024373002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2024373002/20001
4 years, 6 months ago (2016-06-01 05:47:20 UTC) #8
haraken
LGTM on my side.
4 years, 6 months ago (2016-06-01 05:48:28 UTC) #9
Timothy Loh
lgtm! https://codereview.chromium.org/2024373002/diff/1/third_party/WebKit/Source/wtf/text/StringView.cpp File third_party/WebKit/Source/wtf/text/StringView.cpp (right): https://codereview.chromium.org/2024373002/diff/1/third_party/WebKit/Source/wtf/text/StringView.cpp#newcode58 third_party/WebKit/Source/wtf/text/StringView.cpp:58: if (a.isEmpty() || b.isEmpty()) How about: if (a.isEmpty()) ...
4 years, 6 months ago (2016-06-01 05:51:32 UTC) #13
esprehn
On 2016/06/01 at 05:48:28, haraken wrote: > LGTM on my side. Just to double check, ...
4 years, 6 months ago (2016-06-01 05:57:44 UTC) #14
haraken
On 2016/06/01 05:57:44, esprehn wrote: > On 2016/06/01 at 05:48:28, haraken wrote: > > LGTM ...
4 years, 6 months ago (2016-06-01 06:18:34 UTC) #15
esprehn
https://codereview.chromium.org/2024373002/diff/1/third_party/WebKit/Source/wtf/text/StringView.cpp File third_party/WebKit/Source/wtf/text/StringView.cpp (right): https://codereview.chromium.org/2024373002/diff/1/third_party/WebKit/Source/wtf/text/StringView.cpp#newcode58 third_party/WebKit/Source/wtf/text/StringView.cpp:58: if (a.isEmpty() || b.isEmpty()) On 2016/06/01 at 05:51:32, Timothy ...
4 years, 6 months ago (2016-06-01 06:19:04 UTC) #16
esprehn
On 2016/06/01 at 06:19:04, esprehn wrote: > https://codereview.chromium.org/2024373002/diff/1/third_party/WebKit/Source/wtf/text/StringView.cpp > File third_party/WebKit/Source/wtf/text/StringView.cpp (right): > > https://codereview.chromium.org/2024373002/diff/1/third_party/WebKit/Source/wtf/text/StringView.cpp#newcode58 ...
4 years, 6 months ago (2016-06-01 06:20:33 UTC) #17
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2024373002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2024373002/60001
4 years, 6 months ago (2016-06-01 06:20:52 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2024373002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2024373002/60001
4 years, 6 months ago (2016-06-01 07:56:20 UTC) #23
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 6 months ago (2016-06-01 10:12:44 UTC) #24
commit-bot: I haz the power
4 years, 6 months ago (2016-06-01 10:14:26 UTC) #26
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/e3c7c11bf601fc6ffbea29ac7fd02b42c283840a
Cr-Commit-Position: refs/heads/master@{#397094}

Powered by Google App Engine
This is Rietveld 408576698