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

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

Issue 2533093002: [LazyParseCSS] Add histogram for rule usage % (Closed)
Patch Set: rebase 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8c77cb7f48ff5c19dacc83386c8bf327be8063b4 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,36 @@ 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. This enum is used to back a histogram, so new values
+ // must be appended to the end, before UsageLastValue.
+ enum CSSRuleUsage {
+ UsageGe0 = 0,
+ UsageGt10 = 1,
+ UsageGt25 = 2,
+ UsageGt50 = 3,
+ UsageGt75 = 4,
+ UsageGt90 = 5,
+ UsageAll = 6,
+
+ // This value must be last.
+ UsageLastValue = 7
+ };
+
private:
+ void recordUsageMetrics();
+
CSSParserContext m_context;
Vector<String> m_escapedStrings;
// Also referenced on the css resource.
@@ -42,6 +65,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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698