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

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

Issue 1252683002: CSSValue Immediates: Change RefPtr<CSSValue> to store tagged pointers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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/CSSValue.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSValue.cpp
diff --git a/Source/core/css/CSSValue.cpp b/Source/core/css/CSSValue.cpp
index d8a94be96cb0712b2e146f95e0c2bab34ab8f683..b183fa0062c0d0cc172fc22badf88bca72ff7330 100644
--- a/Source/core/css/CSSValue.cpp
+++ b/Source/core/css/CSSValue.cpp
@@ -65,11 +65,14 @@ static_assert(sizeof(CSSValue) <= sizeof(SameSizeAsCSSValue), "CSSValue should s
bool CSSValue::isImplicitInitialValue() const
{
- return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit();
+ return !isTaggedPtr() && classType() == InitialClass && toCSSInitialValue(this)->isImplicit();
}
bool CSSValue::hasFailedOrCanceledSubresources() const
{
+ if (isTaggedPtr())
+ return false;
+
if (isValueList())
return toCSSValueList(this)->hasFailedOrCanceledSubresources();
if (classType() == FontFaceSrcClass)
@@ -92,6 +95,12 @@ inline static bool compareCSSValues(const CSSValue& first, const CSSValue& secon
bool CSSValue::equals(const CSSValue& other) const
{
+ if (isTaggedPtr() && other.isTaggedPtr())
+ return this == &other;
+
+ if (isTaggedPtr() || other.isTaggedPtr())
+ return compareCSSValues<CSSPrimitiveValue>(*this, other);
+
if (m_classType == other.m_classType) {
switch (m_classType) {
case BorderImageSliceClass:
@@ -160,6 +169,9 @@ bool CSSValue::equals(const CSSValue& other) const
String CSSValue::cssText() const
{
+ if (isTaggedPtr())
+ return toCSSPrimitiveValue(this)->customCSSText();
+
switch (classType()) {
case BorderImageSliceClass:
return toCSSBorderImageSliceValue(this)->customCSSText();
@@ -224,6 +236,9 @@ String CSSValue::cssText() const
void CSSValue::destroy()
{
+ if (isTaggedPtr())
+ return;
+
switch (classType()) {
case BorderImageSliceClass:
delete toCSSBorderImageSliceValue(this);
@@ -315,6 +330,9 @@ void CSSValue::destroy()
void CSSValue::finalizeGarbageCollectedObject()
{
+ if (isTaggedPtr())
+ return;
+
switch (classType()) {
case BorderImageSliceClass:
toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue();
@@ -406,6 +424,9 @@ void CSSValue::finalizeGarbageCollectedObject()
DEFINE_TRACE(CSSValue)
{
+ if (isTaggedPtr())
+ return;
+
switch (classType()) {
case BorderImageSliceClass:
toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor);
@@ -495,4 +516,4 @@ DEFINE_TRACE(CSSValue)
ASSERT_NOT_REACHED();
}
-}
+} // namespace blink
« no previous file with comments | « Source/core/css/CSSValue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698