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

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

Issue 2289333003: CSS Lazy Parsing perf jobs (Closed)
Patch Set: CL for src perf tryjob to run blink_style.top_25 benchmark on all-android platform(s) Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CSSParserImpl_h 5 #ifndef CSSParserImpl_h
6 #define CSSParserImpl_h 6 #define CSSParserImpl_h
7 7
8 #include "core/CSSPropertyNames.h" 8 #include "core/CSSPropertyNames.h"
9 #include "core/css/CSSProperty.h" 9 #include "core/css/CSSProperty.h"
10 #include "core/css/CSSPropertySourceData.h" 10 #include "core/css/CSSPropertySourceData.h"
(...skipping 23 matching lines...) Expand all
34 class StyleSheetContents; 34 class StyleSheetContents;
35 class ImmutableStylePropertySet; 35 class ImmutableStylePropertySet;
36 class Element; 36 class Element;
37 class MutableStylePropertySet; 37 class MutableStylePropertySet;
38 38
39 class CSSParserImpl { 39 class CSSParserImpl {
40 STACK_ALLOCATED(); 40 STACK_ALLOCATED();
41 WTF_MAKE_NONCOPYABLE(CSSParserImpl); 41 WTF_MAKE_NONCOPYABLE(CSSParserImpl);
42 42
43 public: 43 public:
44 CSSParserImpl(const CSSParserContext&, StyleSheetContents* = nullptr); 44 CSSParserImpl(const CSSParserContext&,
45 StyleSheetContents* = nullptr,
46 bool deferPropertyParsing = false);
45 47
46 enum AllowedRulesType { 48 enum AllowedRulesType {
47 // As per css-syntax, css-cascade and css-namespaces, @charset rules 49 // As per css-syntax, css-cascade and css-namespaces, @charset rules
48 // must come first, followed by @import then @namespace. 50 // must come first, followed by @import then @namespace.
49 // AllowImportRules actually means we allow @import and any rules thay 51 // AllowImportRules actually means we allow @import and any rules thay
50 // may follow it, i.e. @namespace rules and regular rules. 52 // may follow it, i.e. @namespace rules and regular rules.
51 // AllowCharsetRules and AllowNamespaceRules behave similarly. 53 // AllowCharsetRules and AllowNamespaceRules behave similarly.
52 AllowCharsetRules, 54 AllowCharsetRules,
53 AllowImportRules, 55 AllowImportRules,
54 AllowNamespaceRules, 56 AllowNamespaceRules,
(...skipping 18 matching lines...) Expand all
73 Element*); 75 Element*);
74 static bool parseDeclarationList(MutableStylePropertySet*, 76 static bool parseDeclarationList(MutableStylePropertySet*,
75 const String&, 77 const String&,
76 const CSSParserContext&); 78 const CSSParserContext&);
77 static StyleRuleBase* parseRule(const String&, 79 static StyleRuleBase* parseRule(const String&,
78 const CSSParserContext&, 80 const CSSParserContext&,
79 StyleSheetContents*, 81 StyleSheetContents*,
80 AllowedRulesType); 82 AllowedRulesType);
81 static void parseStyleSheet(const String&, 83 static void parseStyleSheet(const String&,
82 const CSSParserContext&, 84 const CSSParserContext&,
83 StyleSheetContents*); 85 StyleSheetContents*,
86 bool deferPropertyParsing = false);
84 static CSSSelectorList parsePageSelector(CSSParserTokenRange, 87 static CSSSelectorList parsePageSelector(CSSParserTokenRange,
85 StyleSheetContents*); 88 StyleSheetContents*);
86 89
87 static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange); 90 static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange);
88 91
89 static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&); 92 static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&);
90 93
91 bool supportsDeclaration(CSSParserTokenRange&); 94 bool supportsDeclaration(CSSParserTokenRange&);
92 95
93 static void parseDeclarationListForInspector(const String&, 96 static void parseDeclarationListForInspector(const String&,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 bool important, 143 bool important,
141 StyleRule::RuleType); 144 StyleRule::RuleType);
142 void consumeVariableValue(CSSParserTokenRange, 145 void consumeVariableValue(CSSParserTokenRange,
143 const AtomicString& propertyName, 146 const AtomicString& propertyName,
144 bool important, 147 bool important,
145 bool isAnimationTainted); 148 bool isAnimationTainted);
146 149
147 static std::unique_ptr<Vector<double>> consumeKeyframeKeyList( 150 static std::unique_ptr<Vector<double>> consumeKeyframeKeyList(
148 CSSParserTokenRange); 151 CSSParserTokenRange);
149 152
153 static std::unique_ptr<DeferredPropertiesClosure>
154 createDeferredPropertiesClosure(CSSParserTokenRange,
155 const CSSParserContext&,
156 UseCounter*);
157
158 static StylePropertySet* parseDeclarationListForLazyStyle(
159 CSSParserTokenRange,
160 const CSSParserContext*,
161 UseCounter*);
162
163 static bool shouldLazilyParseProperties(const CSSSelectorList& selectors);
164
150 // FIXME: Can we build StylePropertySets directly? 165 // FIXME: Can we build StylePropertySets directly?
151 // FIXME: Investigate using a smaller inline buffer 166 // FIXME: Investigate using a smaller inline buffer
152 HeapVector<CSSProperty, 256> m_parsedProperties; 167 HeapVector<CSSProperty, 256> m_parsedProperties;
153 const CSSParserContext& m_context; 168 const CSSParserContext& m_context;
154 169
155 Member<StyleSheetContents> m_styleSheet; 170 Member<StyleSheetContents> m_styleSheet;
156 171
157 // For the inspector 172 // For the inspector
158 CSSParserObserverWrapper* m_observerWrapper; 173 CSSParserObserverWrapper* m_observerWrapper;
174
175 bool m_deferPropertyParsing;
159 }; 176 };
160 177
161 } // namespace blink 178 } // namespace blink
162 179
163 #endif // CSSParserImpl_h 180 #endif // CSSParserImpl_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParser.cpp ('k') | third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698