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

Issue 2711853003: [LazyParseCSS] WIP Implement token discarding

Created:
3 years, 10 months ago by Charlie Harrison
Modified:
3 years, 9 months ago
Reviewers:
esprehn
CC:
chromium-reviews, blink-reviews-css, dglazkov+blink, apavlov+blink_chromium.org, darktears, blink-reviews, rwlbuis
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[LazyParseCSS] WIP Implement token discarding Initial design idea: Implement an API to CSSLazyPropertyParser to discard lazy tokens. This will get called after some amount of time that the page is stablized (load event + T seconds?). The StyleSheetContents will iterate through all its styles, and have them propagate the signal down to their lazyPropertyParsers. Each lazy property parser will implement token discarding via introspecting their first and last tokens. If both tokens have string backing, and the backing string is identical (i.e. neither token points to the escaped string pool), then we can generate a StringView that encompasses the property set. This StringView is persisted, while the vector of tokens is completely cleared. If the property is told to be parsed, we re-tokenize and parse from the stored StringView. OPEN QUESTIONS: 1. How do we tell if a token is backed by a string in the escaped string pool? Two solutions: a. Make CSSParserToken store an unpacked StringView, which has a pointer to the impl. This can tell us if two tokens share an underlying impl. b. Store a HashSet<void*> (or some other container) in the lazy parsing state, and query it when deciding if we can discard tokens. 2. Is this scheme bug-free assuming (1) is solved? 3. What is the ideal time to discard tokens? 4. Do enough property sets begin and end with a string-backed token? Local testing is showing this is a pretty big portion. BUG=692932

Patch Set 1 #

Patch Set 2 : trybots prev #

Patch Set 3 : Do something silly for escape chars #

Patch Set 4 : lookup in escape string pool #

Unified diffs Side-by-side diffs Delta from patch set Stats (+65 lines, -3 lines) Patch
M third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h View 1 2 3 3 chunks +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp View 1 2 3 2 chunks +11 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSLazyPropertyParserImpl.h View 1 chunk +7 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSLazyPropertyParserImpl.cpp View 1 2 3 2 chunks +43 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (15 generated)
Charlie Harrison
Elliott: I came up with this hack to get string offsets from CSS tokens to ...
3 years, 10 months ago (2017-02-23 21:32:27 UTC) #7
Charlie Harrison
3 years, 10 months ago (2017-02-24 02:16:37 UTC) #13
Oops +esprehn for real this time.

Powered by Google App Engine
This is Rietveld 408576698