Chromium Code Reviews| 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 3234141f9e8102319f61a3445b02234ad56bf2a3..e81fa877855e604aea7953fe77092618c5e1bad4 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h |
| @@ -13,6 +13,7 @@ |
| namespace blink { |
| +class CSSLazyPropertyParserImpl; |
| class CSSParserTokenRange; |
| // This class helps lazy parsing by retaining necessary state. It should not |
| @@ -26,14 +27,32 @@ class CSSLazyParsingState |
| const String& sheetText, |
| StyleSheetContents*); |
| + // Helper method used to bump m_totalStyleRules. |
| + CSSLazyPropertyParserImpl* createLazyParser(const CSSParserTokenRange& block); |
| + |
| const CSSParserContext& context(); |
| + void countRuleParsed(); |
| + |
| bool shouldLazilyParseProperties(const CSSSelectorList&, |
| - const CSSParserTokenRange& block); |
| + const CSSParserTokenRange& block) const; |
| DEFINE_INLINE_TRACE() { visitor->trace(m_owningContents); } |
| + // Exposed for tests. |
|
Ilya Sherman
2016/12/01 00:48:21
Please document that this enum is used to back an
Charlie Harrison
2016/12/01 02:43:51
Done.
|
| + enum CSSRuleUsage { |
| + UsageGe0 = 0, |
| + UsageGt10 = 1, |
| + UsageGt25 = 2, |
| + UsageGt50 = 3, |
| + UsageGt75 = 4, |
| + UsageGt90 = 5, |
| + UsageAll = 6 |
| + }; |
| + |
| private: |
| + void recordUsageMetrics(); |
| + |
| CSSParserContext m_context; |
| Vector<String> m_escapedStrings; |
| // Also referenced on the css resource. |
| @@ -42,6 +61,14 @@ class CSSLazyParsingState |
| // Weak to ensure lazy state will never cause the contents to live longer than |
| // it should (we DCHECK this fact). |
| WeakMember<StyleSheetContents> m_owningContents; |
| + |
| + // Used for calculating the % of rules that ended up being parsed. |
| + int m_parsedStyleRules; |
| + int m_totalStyleRules; |
| + |
| + int m_styleRulesNeededForNextMilestone; |
| + |
| + int m_usage; |
| }; |
| } // namespace blink |