Chromium Code Reviews
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 #
Messages
Total messages: 17 (15 generated)
|
||||||||||||||||||||||||||||||||||||||||||||||