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

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

Issue 137863007: Revert of Move most of the [Pass]RefPtr's of CSSPrimitiveValue to our transition types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/CSSValuePool.h ('k') | Source/core/css/RGBColor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSValuePool.cpp
diff --git a/Source/core/css/CSSValuePool.cpp b/Source/core/css/CSSValuePool.cpp
index 55e78088584c95bbc815918b43a9c8abf96ac8d2..319f8a864613e91c2e88381af5c21a7da12a9bed 100644
--- a/Source/core/css/CSSValuePool.cpp
+++ b/Source/core/css/CSSValuePool.cpp
@@ -53,13 +53,9 @@
, m_colorWhite(CSSPrimitiveValue::createColor(Color::white))
, m_colorBlack(CSSPrimitiveValue::createColor(Color::black))
{
- m_identifierValueCache.resize(numCSSValueKeywords);
- m_pixelValueCache.resize(maximumCacheableIntegerValue + 1);
- m_percentValueCache.resize(maximumCacheableIntegerValue + 1);
- m_numberValueCache.resize(maximumCacheableIntegerValue + 1);
}
-PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createIdentifierValue(CSSValueID ident)
+PassRefPtr<CSSPrimitiveValue> CSSValuePool::createIdentifierValue(CSSValueID ident)
{
if (ident <= 0)
return CSSPrimitiveValue::createIdentifier(ident);
@@ -69,12 +65,12 @@
return m_identifierValueCache[ident];
}
-PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createIdentifierValue(CSSPropertyID ident)
+PassRefPtr<CSSPrimitiveValue> CSSValuePool::createIdentifierValue(CSSPropertyID ident)
{
return CSSPrimitiveValue::createIdentifier(ident);
}
-PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createColorValue(unsigned rgbValue)
+PassRefPtr<CSSPrimitiveValue> CSSValuePool::createColorValue(unsigned rgbValue)
{
// These are the empty and deleted values of the hash table.
if (rgbValue == Color::transparent)
@@ -90,14 +86,14 @@
if (m_colorValueCache.size() > maximumColorCacheSize)
m_colorValueCache.clear();
- RefPtrWillBeRawPtr<CSSPrimitiveValue> dummyValue;
+ RefPtr<CSSPrimitiveValue> dummyValue;
ColorValueCache::AddResult entry = m_colorValueCache.add(rgbValue, dummyValue);
if (entry.isNewEntry)
entry.iterator->value = CSSPrimitiveValue::createColor(rgbValue);
return entry.iterator->value;
}
-PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSPrimitiveValue::UnitTypes type)
+PassRefPtr<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSPrimitiveValue::UnitTypes type)
{
if (value < 0 || value > maximumCacheableIntegerValue)
return CSSPrimitiveValue::create(value, type);
@@ -106,32 +102,34 @@
if (value != intValue)
return CSSPrimitiveValue::create(value, type);
+ RefPtr<CSSPrimitiveValue>* cache;
switch (type) {
case CSSPrimitiveValue::CSS_PX:
- if (!m_pixelValueCache[intValue])
- m_pixelValueCache[intValue] = CSSPrimitiveValue::create(value, type);
- return m_pixelValueCache[intValue];
+ cache = m_pixelValueCache;
+ break;
case CSSPrimitiveValue::CSS_PERCENTAGE:
- if (!m_percentValueCache[intValue])
- m_percentValueCache[intValue] = CSSPrimitiveValue::create(value, type);
- return m_percentValueCache[intValue];
+ cache = m_percentValueCache;
+ break;
case CSSPrimitiveValue::CSS_NUMBER:
- if (!m_numberValueCache[intValue])
- m_numberValueCache[intValue] = CSSPrimitiveValue::create(value, type);
- return m_numberValueCache[intValue];
+ cache = m_numberValueCache;
+ break;
default:
return CSSPrimitiveValue::create(value, type);
}
+
+ if (!cache[intValue])
+ cache[intValue] = CSSPrimitiveValue::create(value, type);
+ return cache[intValue];
}
-PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createValue(const Length& value, const RenderStyle& style)
+PassRefPtr<CSSPrimitiveValue> CSSValuePool::createValue(const Length& value, const RenderStyle& style)
{
return CSSPrimitiveValue::create(value, style.effectiveZoom());
}
-PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String& familyName)
+PassRefPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String& familyName)
{
- RefPtrWillBeMember<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(familyName, 0).iterator->value;
+ RefPtr<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(familyName, 0).iterator->value;
if (!value)
value = CSSPrimitiveValue::create(familyName, CSSPrimitiveValue::CSS_STRING);
return value;
@@ -155,16 +153,7 @@
visitor->trace(m_inheritedValue);
visitor->trace(m_implicitInitialValue);
visitor->trace(m_explicitInitialValue);
- visitor->trace(m_identifierValueCache);
- visitor->trace(m_colorValueCache);
- visitor->trace(m_colorTransparent);
- visitor->trace(m_colorWhite);
- visitor->trace(m_colorBlack);
- visitor->trace(m_pixelValueCache);
- visitor->trace(m_percentValueCache);
- visitor->trace(m_numberValueCache);
visitor->trace(m_fontFaceValueCache);
- visitor->trace(m_fontFamilyValueCache);
}
}
« no previous file with comments | « Source/core/css/CSSValuePool.h ('k') | Source/core/css/RGBColor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698