Bug 576044 (4/12): eliminate ValuePairList as a storage type. r=dbaron a2.0=dbaron

This commit is contained in:
Zack Weinberg
2010-08-19 15:33:44 -04:00
parent 1d56fbae0e
commit 698cc2a773
12 changed files with 457 additions and 427 deletions

View File

@@ -247,8 +247,7 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
cursor += CDBValueStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_ValuePairList: {
case eCSSType_ValueList: {
void** target = static_cast<void**>(prop);
if (!*target) {
if (ShouldStartImageLoads(aRuleData, iProp)) {
@@ -278,8 +277,7 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
cursor += CDBValueStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_ValuePairList: {
case eCSSType_ValueList: {
cursor += CDBPointerStorage_advance;
} break;
}
@@ -313,8 +311,7 @@ nsCSSCompressedDataBlock::StorageFor(nsCSSProperty aProperty) const
case eCSSType_Value: {
return ValueAtCursor(cursor);
}
case eCSSType_ValueList:
case eCSSType_ValuePairList: {
case eCSSType_ValueList: {
return &PointerAtCursor(const_cast<char*>(cursor));
}
}
@@ -324,8 +321,7 @@ nsCSSCompressedDataBlock::StorageFor(nsCSSProperty aProperty) const
cursor += CDBValueStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_ValuePairList: {
case eCSSType_ValueList: {
cursor += CDBPointerStorage_advance;
} break;
}
@@ -363,22 +359,8 @@ nsCSSCompressedDataBlock::Clone() const
result_cursor += CDBValueStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_ValuePairList: {
void *copy;
NS_ASSERTION(PointerAtCursor(cursor), "oops");
switch (nsCSSProps::kTypeTable[iProp]) {
default:
NS_NOTREACHED("unreachable");
// fall through to keep gcc's uninitialized
// variable warning quiet
case eCSSType_ValueList:
copy = ValueListAtCursor(cursor)->Clone();
break;
case eCSSType_ValuePairList:
copy = ValuePairListAtCursor(cursor)->Clone();
break;
}
case eCSSType_ValueList: {
void *copy = ValueListAtCursor(cursor)->Clone();
if (!copy) {
// so the destructor knows where to stop clearing
result->mBlockEnd = result_cursor;
@@ -422,13 +404,6 @@ nsCSSCompressedDataBlock::~nsCSSCompressedDataBlock()
delete val;
cursor += CDBPointerStorage_advance;
} break;
case eCSSType_ValuePairList: {
nsCSSValuePairList* val = ValuePairListAtCursor(cursor);
NS_ASSERTION(val, "oops");
delete val;
cursor += CDBPointerStorage_advance;
} break;
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
@@ -467,18 +442,6 @@ nsCSSCompressedDataBlock::MoveValue(void *aSource, void *aDest,
*dest = *source;
*source = nsnull;
} break;
case eCSSType_ValuePairList: {
nsCSSValuePairList **source =
static_cast<nsCSSValuePairList**>(aSource);
nsCSSValuePairList **dest =
static_cast<nsCSSValuePairList**>(aDest);
if (**source != **dest)
*aChanged = PR_TRUE;
delete *dest;
*dest = *source;
*source = nsnull;
} break;
}
}
@@ -538,8 +501,7 @@ nsCSSExpandedDataBlock::DoExpand(nsCSSCompressedDataBlock *aBlock,
cursor += CDBValueStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_ValuePairList: {
case eCSSType_ValueList: {
void* val = PointerAtCursor(cursor);
void** dest = static_cast<void**>(prop);
NS_ASSERTION(val, "oops");
@@ -596,8 +558,7 @@ nsCSSExpandedDataBlock::ComputeSize()
increment = CDBValueStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_ValuePairList: {
case eCSSType_ValueList: {
#ifdef DEBUG
void* val = *static_cast<void**>(prop);
NS_ASSERTION(val, "Null pointer while computing size");
@@ -676,8 +637,7 @@ nsCSSExpandedDataBlock::Compress(nsCSSCompressedDataBlock **aNormalBlock,
cursor += CDBValueStorage_advance;
} break;
case eCSSType_ValueList:
case eCSSType_ValuePairList: {
case eCSSType_ValueList: {
void*& val = *static_cast<void**>(prop);
NS_ASSERTION(val, "Null pointer while compressing");
CDBPointerStorage *storage =
@@ -761,15 +721,6 @@ nsCSSExpandedDataBlock::ClearLonghandProperty(nsCSSProperty aPropID)
val = nsnull;
}
} break;
case eCSSType_ValuePairList: {
nsCSSValuePairList*& val =
*static_cast<nsCSSValuePairList**>(prop);
if (val) {
delete val;
val = nsnull;
}
} break;
}
}
@@ -860,12 +811,6 @@ nsCSSExpandedDataBlock::DoAssertInitialState()
nsCSSValueList* val = *static_cast<nsCSSValueList**>(prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
case eCSSType_ValuePairList: {
nsCSSValuePairList* val =
*static_cast<nsCSSValuePairList**>(prop);
NS_ASSERTION(val == nsnull, "not initial state");
} break;
}
}
}