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

Unified Diff: third_party/WebKit/Source/core/css/StyleRule.h

Issue 2315923002: Lazy Parse CSS (Closed)
Patch Set: s/->/. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/StyleRule.h
diff --git a/third_party/WebKit/Source/core/css/StyleRule.h b/third_party/WebKit/Source/core/css/StyleRule.h
index f7098ecadac418056cfe9af359b134ddbb27045a..1394c876241ee6317a9965ed34a06b8b40f1b78c 100644
--- a/third_party/WebKit/Source/core/css/StyleRule.h
+++ b/third_party/WebKit/Source/core/css/StyleRule.h
@@ -97,11 +97,15 @@ public:
{
return new StyleRule(std::move(selectorList), properties);
}
+ static StyleRule* createLazy(CSSSelectorList selectorList, std::unique_ptr<DeferredPropertiesClosure> deferredProperties)
+ {
+ return new StyleRule(std::move(selectorList), std::move(deferredProperties));
+ }
~StyleRule();
const CSSSelectorList& selectorList() const { return m_selectorList; }
- const StylePropertySet& properties() const { return *m_properties; }
+ const StylePropertySet& properties() const;
MutableStylePropertySet& mutableProperties();
void wrapperAdoptSelectorList(CSSSelectorList selectors) { m_selectorList = std::move(selectors); }
@@ -110,14 +114,20 @@ public:
static unsigned averageSizeInBytes();
+ // Helper methods to avoid parsing lazy properties when not needed.
+ bool propertiesHaveFailedOrCanceledSubresources() const;
+ bool shouldConsiderForMatchingRules(bool includeEmptyRules) const;
+
DECLARE_TRACE_AFTER_DISPATCH();
private:
StyleRule(CSSSelectorList, StylePropertySet*);
+ StyleRule(CSSSelectorList, std::unique_ptr<DeferredPropertiesClosure>);
StyleRule(const StyleRule&);
- Member<StylePropertySet> m_properties; // Cannot be null.
CSSSelectorList m_selectorList;
+ mutable Member<StylePropertySet> m_properties;
+ mutable std::unique_ptr<DeferredPropertiesClosure> m_deferred;
};
class StyleRuleFontFace : public StyleRuleBase {

Powered by Google App Engine
This is Rietveld 408576698