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

Unified Diff: Source/core/css/CSSPrimitiveValue.cpp

Issue 1226273002: CSSValue Immediates: Make CSSPrimitiveValue store a tagged pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_2_attempt_2
Patch Set: Rebase Created 5 years, 5 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 | « Source/core/css/CSSPrimitiveValue.h ('k') | Source/core/css/CSSPrimitiveValueTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSPrimitiveValue.cpp
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index ac92c915ed05ef33572861d7d0da2fd0d5f943c0..9ce689f0d8ddb277d4fe760890f54f16b6c724d2 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -946,9 +946,12 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type)
String CSSPrimitiveValue::customCSSText() const
{
- if (hasCachedCSSText()) {
- ASSERT(cssTextCache().contains(m_rawValue));
- return cssTextCache().get(m_rawValue);
+ if (!isObject() && cssTextCache().contains(m_rawValue.asPtr))
+ return cssTextCache().get(m_rawValue.asPtr);
+
+ if (isObject() && m_rawValue.asPtr->m_hasCachedCSSText) {
+ ASSERT(cssTextCache().contains(m_rawValue.asPtr));
+ return cssTextCache().get(m_rawValue.asPtr);
}
String text;
@@ -1062,9 +1065,10 @@ String CSSPrimitiveValue::customCSSText() const
break;
}
- ASSERT(!cssTextCache().contains(m_rawValue));
- cssTextCache().set(m_rawValue, text);
- setHasCachedCSSText(true);
+ ASSERT(!cssTextCache().contains(m_rawValue.asPtr));
+ cssTextCache().set(m_rawValue.asPtr, text);
+ if (isObject())
+ m_rawValue.asPtr->m_hasCachedCSSText = true;
return text;
}
« no previous file with comments | « Source/core/css/CSSPrimitiveValue.h ('k') | Source/core/css/CSSPrimitiveValueTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698