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

Issue 2897833004: Refactored out need to pass property ID in background list parsing. (Closed)

Created:
3 years, 7 months ago by Bugs Nash
Modified:
3 years, 5 months ago
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-style_chromium.org, chromium-reviews, dglazkov+blink, rwlbuis
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactored out need to pass property ID in background list parsing. This patch - Moved AddBackgroundValue to CSSPropertyParserHelpers and renamed it to AddListValueOptimised, for use in ConsumeCommaSeparatedList helper - Added a memory optimisation option to ConsumeCommaSeparatedList, allowing background component lists to use this method without changing any behavior. The optimisation option will not wrap a single value in a list, but will return a single CSSValue. Use of this optimisation can be more easily changed in future. - Added DCHECKs to ensure that call sites that expect a list returned from ConsumeCommaSeparatedList do receive a list (as the return type has changed to the more general CSSValue) - Deleted ConsumeCommaSeparatedBackgroundComponent, instead using the more general ConsumeCommaSeparatedList template - Split property specific parsing logic for background components into the case statements in CSSPropertyParser::ParseSingleValue, ready to be moved to property APIs. Logic for this was copied from ConsumeBackgroundComponent. Note that ConsumeBackgroundComponent is still currently used in ConsumeBackgroundShorthand and so cannot yet be deleted. BUG=668012

Patch Set 1 #

Patch Set 2 : removed whitespace #

Patch Set 3 : Replaced AddBackgroundValue with generic AddListValueOptimized #

Patch Set 4 : changed bool to enum as per style guide #

Total comments: 8

Patch Set 5 : changed enum to enum class and addressed comments #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+97 lines, -62 lines) Patch
M third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp View 1 2 3 4 7 chunks +60 lines, -54 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h View 1 2 3 4 2 chunks +21 lines, -8 lines 2 comments Download
M third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp View 1 2 3 4 1 chunk +14 lines, -0 lines 2 comments Download
M third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationName.cpp View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 30 (16 generated)
Bugs Nash
removed whitespace
3 years, 7 months ago (2017-05-22 06:12:35 UTC) #3
Bugs Nash
3 years, 7 months ago (2017-05-22 06:14:42 UTC) #7
Bugs Nash
3 years, 7 months ago (2017-05-22 21:31:05 UTC) #13
Jia
https://codereview.chromium.org/2897833004/diff/60001/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp File third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp (right): https://codereview.chromium.org/2897833004/diff/60001/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp#newcode1633 third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp:1633: return ConsumeCommaSeparatedList(kNoOptimisation, ConsumeTime, range_, Please consider add some description ...
3 years, 7 months ago (2017-05-23 23:56:14 UTC) #19
Bugs Nash
changed enum to enum class and addressed comments
3 years, 6 months ago (2017-06-02 05:40:19 UTC) #20
Bugs Nash
sorry about the delay here, ptal https://codereview.chromium.org/2897833004/diff/60001/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp File third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp (right): https://codereview.chromium.org/2897833004/diff/60001/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp#newcode1633 third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp:1633: return ConsumeCommaSeparatedList(kNoOptimisation, ConsumeTime, ...
3 years, 6 months ago (2017-06-02 05:42:19 UTC) #21
Jia
On 2017/06/02 05:42:19, Bugs Nash wrote: > sorry about the delay here, ptal > > ...
3 years, 6 months ago (2017-06-04 23:30:44 UTC) #22
Bugs Nash
+suzyh for owners
3 years, 6 months ago (2017-06-05 00:07:33 UTC) #24
suzyh_UTC10 (ex-contributor)
Hrmm... I'm undecided how I feel about this one. It's a gnarly problem, and this ...
3 years, 6 months ago (2017-06-05 00:49:20 UTC) #25
Bugs Nash
On 2017/06/05 at 00:49:20, suzyh wrote: > Hrmm... I'm undecided how I feel about this ...
3 years, 6 months ago (2017-06-05 01:20:39 UTC) #26
Bugs Nash
https://codereview.chromium.org/2897833004/diff/80001/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp File third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp (right): https://codereview.chromium.org/2897833004/diff/80001/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp#newcode1461 third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp:1461: void AddListValueOptimized(CSSValue*& list, CSSValue* value) { On 2017/06/05 at ...
3 years, 6 months ago (2017-06-05 01:20:50 UTC) #27
suzyh_UTC10 (ex-contributor)
> > If we do want to keep the optimization, how do you feel about ...
3 years, 6 months ago (2017-06-05 01:43:59 UTC) #28
Bugs Nash
On 2017/06/05 at 01:43:59, suzyh wrote: > > > If we do want to keep ...
3 years, 6 months ago (2017-06-05 01:56:39 UTC) #29
Bugs Nash
3 years, 5 months ago (2017-07-18 05:40:15 UTC) #30
Message was sent while issue was closed.
On 2017/06/05 at 01:56:39, Bugs Nash wrote:
> On 2017/06/05 at 01:43:59, suzyh wrote:
> > > > If we do want to keep the optimization, how do you feel about a separate
method ConsumeSingleValueOrCommaSeparatedList(*) that does the optimized
version, and having ConsumeCommaSeparatedList call that and wrap the result in a
list if it is just a single item? That way the call site knows whether it's
calling the optimized version or is definitely getting a list, without the enum
and extra DCHECKs?
> > > > (*) Naming is hard.
> > > 
> > > Hmm not sure I would want the non optimized method to call through to the
optimised method, as the optimised method requires more work, branching and
changing the type of value etc. without the optimization that's not necessary.
Perhaps split them out into separate methods with some duplicate logic? Perhaps
have the optimised version call through to the non optimised version and remove
the list wrapping if there's only 1 item? none of the options are ideal really.
what are your thoughts?
> > 
> > LOL at the idea that the "optimised" version does more work and it is
therefore cheaper for the "optimised" version to call the "non-optimised"
version. If that's really the case, then I think we need to be clearer that the
optimisation is for the caller, not within the function itself.
> 
> yeah it's a memory optimization, not a performance optimization. the method
comment covers that, is that enough?
> 
> > 
> > As discussed offline, let's first see what the performance hit is from
making all callsites use the non-optimised version. Then if that doesn't fly, we
can decide whether to do "optimised version then wrap in list" or "non-optimised
version then fetch first and only element".
> 
> sgtm

Closed as this has been rewritten at
https://chromium-review.googlesource.com/c/575253/

Powered by Google App Engine
This is Rietveld 408576698