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

Unified Diff: Source/core/css/parser/CSSParserToken.h

Issue 1161963002: Shrinking CSSParserToken for lower CSS parsing memory usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unused union members. Created 5 years, 7 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
« no previous file with comments | « no previous file | Source/core/css/parser/CSSParserToken.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSParserToken.h
diff --git a/Source/core/css/parser/CSSParserToken.h b/Source/core/css/parser/CSSParserToken.h
index fe3d989b6fd9c665cd23fe0912db59f4a3953fa4..cea4dd4af1433722ac7db25e8e7747200e75c36d 100644
--- a/Source/core/css/parser/CSSParserToken.h
+++ b/Source/core/css/parser/CSSParserToken.h
@@ -87,8 +87,13 @@ public:
void convertToPercentage();
CSSParserTokenType type() const { return static_cast<CSSParserTokenType>(m_type); }
- CSSParserString value() const { return m_value; }
- bool valueEqualsIgnoringCase(const char* str) const { return m_value.equalIgnoringCase(str); }
+ CSSParserString value() const
+ {
+ CSSParserString ret;
+ ret.initRaw(m_valueDataCharRaw, m_valueLength, m_valueIs8Bit);
+ return ret;
+ }
+ bool valueEqualsIgnoringCase(const char* str) const { return value().equalIgnoringCase(str); }
UChar delimiter() const;
NumericSign numericSign() const;
@@ -105,13 +110,23 @@ public:
void serialize(StringBuilder&) const;
private:
+ void initValueFromCSSParserString(const CSSParserString& value)
+ {
+ m_valueLength = value.m_length;
+ m_valueIs8Bit = value.m_is8Bit;
+ m_valueDataCharRaw = value.m_data.charactersRaw;
+ }
unsigned m_type : 6; // CSSParserTokenType
unsigned m_blockType : 2; // BlockType
unsigned m_numericValueType : 1; // NumericValueType
unsigned m_numericSign : 2; // NumericSign
unsigned m_unit : 7; // CSSPrimitiveValue::UnitType
- CSSParserString m_value; // FIXME: Pack this better?
+ // m_value... is an unpacked CSSParserString so that we can pack it
+ // tightly with the rest of this object for a smaller object size.
+ bool m_valueIs8Bit : 1;
+ unsigned m_valueLength;
+ const void* m_valueDataCharRaw; // Either LChar* or UChar*.
union {
UChar m_delimiter;
« no previous file with comments | « no previous file | Source/core/css/parser/CSSParserToken.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698