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

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

Issue 1481383002: [Experimental] CSSSerializer Proof-of-concept Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: snapshot: top_25 sites ser/dser now works Created 4 years, 11 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 a631def8ef10ff48d9c2a63e066411b150f6c9f0..4c802f27d1c242dc9c65c5dd962b3e443c432aa6 100644
--- a/third_party/WebKit/Source/core/css/StyleRule.h
+++ b/third_party/WebKit/Source/core/css/StyleRule.h
@@ -31,8 +31,10 @@
namespace blink {
+class CSSDeserializeStream;
class CSSRule;
class CSSStyleSheet;
+class CSSSerializeStream;
class CORE_EXPORT StyleRuleBase : public RefCountedWillBeGarbageCollectedFinalized<StyleRuleBase> {
USING_FAST_MALLOC_WITH_TYPE_NAME_WILL_BE_REMOVED(blink::StyleRuleBase);
@@ -65,6 +67,7 @@ public:
bool isViewportRule() const { return type() == Viewport; }
bool isImportRule() const { return type() == Import; }
+ static PassRefPtrWillBeRawPtr<StyleRuleBase> deserialize(CSSDeserializeStream*);
PassRefPtrWillBeRawPtr<StyleRuleBase> copy() const;
#if !ENABLE(OILPAN)
@@ -79,6 +82,8 @@ public:
PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = 0) const;
PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const;
+ void serialize(CSSSerializeStream*) const;
+
DECLARE_TRACE();
DEFINE_INLINE_TRACE_AFTER_DISPATCH() { }
void finalizeGarbageCollectedObject();
@@ -122,6 +127,9 @@ public:
static unsigned averageSizeInBytes();
+ static PassRefPtrWillBeRawPtr<StyleRule> deserializeAfterDispatch(CSSDeserializeStream*);
+ void serializeAfterDispatch(CSSSerializeStream*) const;
+
DECLARE_TRACE_AFTER_DISPATCH();
private:
@@ -138,6 +146,7 @@ public:
{
return adoptRefWillBeNoop(new StyleRuleFontFace(properties));
}
+ static PassRefPtrWillBeRawPtr<StyleRuleFontFace> deserializeAfterDispatch(CSSDeserializeStream*);
~StyleRuleFontFace();
@@ -146,6 +155,8 @@ public:
PassRefPtrWillBeRawPtr<StyleRuleFontFace> copy() const { return adoptRefWillBeNoop(new StyleRuleFontFace(*this)); }
+ void serializeAfterDispatch(CSSSerializeStream*) const;
+
DECLARE_TRACE_AFTER_DISPATCH();
private:
@@ -190,9 +201,16 @@ public:
void wrapperInsertRule(unsigned, PassRefPtrWillBeRawPtr<StyleRuleBase>);
void wrapperRemoveRule(unsigned);
+ void serializeAfterDispatch(CSSSerializeStream*) const;
+ void deserializeAfterDispatch(CSSDeserializeStream*);
+
DECLARE_TRACE_AFTER_DISPATCH();
protected:
+ StyleRuleGroup(Type type)
+ : StyleRuleBase(type)
+ {
+ }
StyleRuleGroup(Type, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& adoptRule);
StyleRuleGroup(const StyleRuleGroup&);
@@ -200,22 +218,29 @@ private:
WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>> m_childRules;
};
-class StyleRuleMedia : public StyleRuleGroup {
+class StyleRuleMedia final : public StyleRuleGroup {
public:
static PassRefPtrWillBeRawPtr<StyleRuleMedia> create(PassRefPtrWillBeRawPtr<MediaQuerySet> media, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& adoptRules)
{
return adoptRefWillBeNoop(new StyleRuleMedia(media, adoptRules));
}
+ static PassRefPtrWillBeRawPtr<StyleRuleMedia> deserializeAfterDispatch(CSSDeserializeStream*);
MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
PassRefPtrWillBeRawPtr<StyleRuleMedia> copy() const { return adoptRefWillBeNoop(new StyleRuleMedia(*this)); }
+ void serializeAfterDispatch(CSSSerializeStream*) const;
+
DECLARE_TRACE_AFTER_DISPATCH();
private:
StyleRuleMedia(PassRefPtrWillBeRawPtr<MediaQuerySet>, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& adoptRules);
StyleRuleMedia(const StyleRuleMedia&);
+ StyleRuleMedia()
+ : StyleRuleGroup(Media)
+ {
+ }
RefPtrWillBeMember<MediaQuerySet> m_mediaQueries;
};
« no previous file with comments | « third_party/WebKit/Source/core/css/StylePropertySet.cpp ('k') | third_party/WebKit/Source/core/css/StyleRule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698