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

Unified Diff: third_party/WebKit/Source/core/css/CSSValue.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/CSSValue.h
diff --git a/third_party/WebKit/Source/core/css/CSSValue.h b/third_party/WebKit/Source/core/css/CSSValue.h
index 69c3d0ac57366d6745d7c5416d0847d148fc85b9..310f0e8a52f175933d8ccbe3fc8d0579dde6d586 100644
--- a/third_party/WebKit/Source/core/css/CSSValue.h
+++ b/third_party/WebKit/Source/core/css/CSSValue.h
@@ -31,6 +31,9 @@
namespace blink {
+class CSSDeserializeStream;
+class CSSSerializeStream;
+
class CORE_EXPORT CSSValue : public RefCountedWillBeGarbageCollectedFinalized<CSSValue> {
#if ENABLE(OILPAN)
public:
@@ -112,6 +115,9 @@ public:
bool equals(const CSSValue&) const;
+ static PassRefPtrWillBeRawPtr<CSSValue> deserialize(CSSDeserializeStream*);
+ void serialize(CSSSerializeStream*) const;
+
void finalizeGarbageCollectedObject();
DEFINE_INLINE_TRACE_AFTER_DISPATCH() { }
DECLARE_TRACE();
@@ -122,7 +128,8 @@ public:
// 'source\wtf\refcounted.h' by using msvc.
~CSSValue() { }
-protected:
+ // protected:
+public:
static const size_t ClassTypeBits = 6;
enum ClassType {
PrimitiveClass,
@@ -212,13 +219,31 @@ protected:
// to maximize struct packing.
// CSSPrimitiveValue bits:
- unsigned m_primitiveUnitType : 7; // CSSPrimitiveValue::UnitType
- mutable unsigned m_hasCachedCSSText : 1;
+ union {
+ struct {
+ unsigned m_primitiveUnitType : 7; // CSSPrimitiveValue::UnitType
+ mutable unsigned m_hasCachedCSSText : 1;
- unsigned m_valueListSeparator : ValueListSeparatorBits;
+ unsigned m_valueListSeparator : ValueListSeparatorBits;
-private:
- unsigned m_classType : ClassTypeBits; // ClassType
+ // private:
+ unsigned m_classType : ClassTypeBits; // ClassType
+ };
+ unsigned m_bitfields;
+ };
+
+ union aaaa {
+ struct {
+ unsigned m_primitiveUnitType : 7; // CSSPrimitiveValue::UnitType
+ mutable unsigned m_hasCachedCSSText : 1;
+
+ unsigned m_valueListSeparator : ValueListSeparatorBits;
+
+ // private:
+ unsigned m_classType : ClassTypeBits; // ClassType
+ };
+ unsigned m_bitfields;
+ };
};
template<typename CSSValueType, size_t inlineCapacity>
@@ -268,6 +293,23 @@ inline bool compareCSSValuePtr(const Member<CSSValueType>& first, const Member<C
return first->equals(*second);
}
+template<typename T> class CSSSerializeTrait;
+template<> class CSSSerializeTrait<CSSValue> {
+public:
+ static void serializeNull(CSSSerializeStream*);
+ static void serializeNonNullHeader(CSSSerializeStream*) { }
+};
+
+template<typename T> class CSSDeserializeTrait;
+template<> class CSSDeserializeTrait<CSSValue> {
+public:
+ static bool deserializeNonNullHeader(CSSDeserializeStream*)
+ {
+ // CSSValue::deserialize will return nullptr if needed.
+ return true;
+ }
+};
+
#define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \
DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, value.predicate)
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSUnicodeRangeValue.cpp ('k') | third_party/WebKit/Source/core/css/CSSValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698