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

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

Issue 2315923002: Lazy Parse CSS (Closed)
Patch Set: plug leaks 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..43b546d66933e32d62d67235b908aca7d2f8ba5c 100644
--- a/third_party/WebKit/Source/core/css/StyleRule.h
+++ b/third_party/WebKit/Source/core/css/StyleRule.h
@@ -26,6 +26,7 @@
#include "core/css/CSSSelectorList.h"
#include "core/css/MediaList.h"
#include "core/css/StylePropertySet.h"
+#include "core/css/parser/CSSParser.h"
Timothy Loh 2016/09/26 05:18:00 I don't really like this dependency, maybe the typ
Charlie Harrison 2016/09/26 22:14:45 Sure. Done.
#include "platform/heap/Handle.h"
#include "wtf/RefPtr.h"
@@ -97,11 +98,15 @@ public:
{
return new StyleRule(std::move(selectorList), properties);
}
+ static StyleRule* createLazy(CSSSelectorList selectorList, std::unique_ptr<CSSParser::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 +115,20 @@ public:
static unsigned averageSizeInBytes();
+ // Helper methods to avoid parsing lazy properties when not needed.
+ bool propertiesHaveFailedOrCanceledSubresources() const;
+ bool hasEmptyProperties() const;
+
DECLARE_TRACE_AFTER_DISPATCH();
private:
StyleRule(CSSSelectorList, StylePropertySet*);
+ StyleRule(CSSSelectorList, std::unique_ptr<CSSParser::DeferredPropertiesClosure>);
StyleRule(const StyleRule&);
- Member<StylePropertySet> m_properties; // Cannot be null.
CSSSelectorList m_selectorList;
+ mutable Member<StylePropertySet> m_properties;
+ mutable std::unique_ptr<CSSParser::DeferredPropertiesClosure> m_deferred;
};
class StyleRuleFontFace : public StyleRuleBase {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/StyleRule.cpp » ('j') | third_party/WebKit/Source/core/css/StyleRule.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698