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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h

Issue 2474483002: [LazyParseCSS] Ensure UseCounting has parity with strict parsing (Closed)
Patch Set: s/!/!!/ Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h
diff --git a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h
index 8c77cb7f48ff5c19dacc83386c8bf327be8063b4..80c846f6c4beb2837ba81f43402eebb2eb9ec14d 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h
@@ -37,7 +37,7 @@ class CSSLazyParsingState
bool shouldLazilyParseProperties(const CSSSelectorList&,
const CSSParserTokenRange& block) const;
- DEFINE_INLINE_TRACE() { visitor->trace(m_owningContents); }
+ DECLARE_TRACE();
// Exposed for tests. This enum is used to back a histogram, so new values
// must be appended to the end, before UsageLastValue.
@@ -66,6 +66,10 @@ class CSSLazyParsingState
// it should (we DCHECK this fact).
WeakMember<StyleSheetContents> m_owningContents;
+ // Cache the document as a proxy for caching the UseCounter. Grabbing the
+ // UseCounter per every property parse is a bit more expensive.
+ WeakMember<Document> m_document;
+
// Used for calculating the % of rules that ended up being parsed.
int m_parsedStyleRules;
int m_totalStyleRules;
@@ -73,6 +77,11 @@ class CSSLazyParsingState
int m_styleRulesNeededForNextMilestone;
int m_usage;
+
+ // Whether or not use counting is enabled for parsing. This will usually be
+ // true, except for when stylesheets with @imports are removed from the page.
+ // See StyleRuleImport::setCSSStyleSheet.
+ const bool m_shouldUseCount;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698