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

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

Issue 2687023003: [LazyParseCSS] Add metrics for total # of rules at 0% and 100% usage (Closed)
Patch Set: rune review Created 3 years, 10 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CSSLazyParsingState_h 5 #ifndef CSSLazyParsingState_h
6 #define CSSLazyParsingState_h 6 #define CSSLazyParsingState_h
7 7
8 #include "core/css/CSSSelectorList.h" 8 #include "core/css/CSSSelectorList.h"
9 #include "core/css/StyleSheetContents.h" 9 #include "core/css/StyleSheetContents.h"
10 #include "core/css/parser/CSSParserMode.h" 10 #include "core/css/parser/CSSParserMode.h"
11 #include "wtf/Vector.h" 11 #include "wtf/Vector.h"
12 #include "wtf/text/WTFString.h" 12 #include "wtf/text/WTFString.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class CSSLazyPropertyParserImpl; 16 class CSSLazyPropertyParserImpl;
17 class CSSParserTokenRange; 17 class CSSParserTokenRange;
18 18
19 // This class helps lazy parsing by retaining necessary state. It should not 19 // This class helps lazy parsing by retaining necessary state. It should not
20 // outlive the StyleSheetContents that initiated the parse, as it retains a raw 20 // outlive the StyleSheetContents that initiated the parse, as it retains a raw
21 // reference to the UseCounter associated with the style sheet. 21 // reference to the UseCounter associated with the style sheet.
22 class CSSLazyParsingState 22 class CSSLazyParsingState
23 : public GarbageCollectedFinalized<CSSLazyParsingState> { 23 : public GarbageCollectedFinalized<CSSLazyParsingState> {
24 public: 24 public:
25 CSSLazyParsingState(const CSSParserContext*, 25 CSSLazyParsingState(const CSSParserContext*,
26 Vector<String> escapedStrings, 26 Vector<String> escapedStrings,
27 const String& sheetText, 27 const String& sheetText,
28 StyleSheetContents*); 28 StyleSheetContents*);
29 29
30 // Called when all lazy property parsers are initialized. At this point we
31 // know the total number of style rules that deferred parsing.
32 void finishInitialParsing();
33
30 // Helper method used to bump m_totalStyleRules. 34 // Helper method used to bump m_totalStyleRules.
31 CSSLazyPropertyParserImpl* createLazyParser(const CSSParserTokenRange& block); 35 CSSLazyPropertyParserImpl* createLazyParser(const CSSParserTokenRange& block);
32 36
33 const CSSParserContext* context(); 37 const CSSParserContext* context();
34 38
35 void countRuleParsed(); 39 void countRuleParsed();
36 40
37 bool shouldLazilyParseProperties(const CSSSelectorList&, 41 bool shouldLazilyParseProperties(const CSSSelectorList&,
38 const CSSParserTokenRange& block) const; 42 const CSSParserTokenRange& block) const;
39 43
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 84
81 // Whether or not use counting is enabled for parsing. This will usually be 85 // Whether or not use counting is enabled for parsing. This will usually be
82 // true, except for when stylesheets with @imports are removed from the page. 86 // true, except for when stylesheets with @imports are removed from the page.
83 // See StyleRuleImport::setCSSStyleSheet. 87 // See StyleRuleImport::setCSSStyleSheet.
84 const bool m_shouldUseCount; 88 const bool m_shouldUseCount;
85 }; 89 };
86 90
87 } // namespace blink 91 } // namespace blink
88 92
89 #endif // CSSLazyParsingState_h 93 #endif // CSSLazyParsingState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698