Bug 1026345 - Remove the now unused nsStyleContext allocation functions. r=dbaron

This commit is contained in:
Cameron McCormack 2014-06-19 13:19:11 +10:00
parent 5a3e19e62c
commit ab79bfe830
2 changed files with 0 additions and 63 deletions

View File

@ -41,7 +41,6 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
mEmptyChild(nullptr),
mPseudoTag(aPseudoTag),
mRuleNode(aRuleNode),
mAllocations(nullptr),
mCachedResetData(nullptr),
mBits(((uint64_t)aPseudoType) << NS_STYLE_CONTEXT_TYPE_SHIFT),
mRefCnt(0)
@ -100,8 +99,6 @@ nsStyleContext::~nsStyleContext()
if (mCachedResetData) {
mCachedResetData->Destroy(mBits, presContext);
}
FreeAllocations(presContext);
}
void nsStyleContext::AddChild(nsStyleContext* aChild)
@ -841,34 +838,6 @@ nsStyleContext::CombineVisitedColors(nscolor *aColors, bool aLinkIsVisited)
NS_GET_B(colorColor), NS_GET_A(alphaColor));
}
void*
nsStyleContext::Alloc(size_t aSize)
{
nsIPresShell *shell = PresContext()->PresShell();
aSize += offsetof(AllocationHeader, mStorageStart);
AllocationHeader *alloc =
static_cast<AllocationHeader*>(shell->AllocateMisc(aSize));
alloc->mSize = aSize; // NOTE: inflated by header
alloc->mNext = mAllocations;
mAllocations = alloc;
return static_cast<void*>(&alloc->mStorageStart);
}
void
nsStyleContext::FreeAllocations(nsPresContext *aPresContext)
{
nsIPresShell *shell = aPresContext->PresShell();
for (AllocationHeader *alloc = mAllocations, *next; alloc; alloc = next) {
next = alloc->mNext;
shell->FreeMisc(alloc->mSize, alloc);
}
}
#ifdef DEBUG
/* static */ void
nsStyleContext::AssertStyleStructMaxDifferenceValid()

View File

@ -312,27 +312,6 @@ public:
static nscolor CombineVisitedColors(nscolor *aColors,
bool aLinkIsVisited);
/**
* Allocate a chunk of memory that is scoped to the lifetime of this
* style context, i.e., memory that will automatically be freed when
* this style context is destroyed. This is intended for allocations
* that are stored on this style context or its style structs. (Use
* on style structs is fine since any style context to which this
* context's style structs are shared will be a descendant of this
* style context and thus keep it alive.)
*
* This currently allocates the memory out of the pres shell arena.
*
* It would be relatively straightforward to write a Free method
* for the underlying implementation, but we don't need it (or the
* overhead of making a doubly-linked list or other structure to
* support it).
*
* WARNING: Memory allocated using this method cannot be stored in the
* rule tree, since rule nodes may outlive the style context.
*/
void* Alloc(size_t aSize);
/**
* Start the background image loads for this style context.
*/
@ -352,8 +331,6 @@ protected:
void ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup);
void FreeAllocations(nsPresContext* aPresContext);
// Helper function that GetStyleData and GetUniqueStyleData use. Only
// returns the structs we cache ourselves; never consults the ruletree.
inline const void* GetCachedStyleData(nsStyleStructID aSID);
@ -414,15 +391,6 @@ protected:
// |mRule| member of |mRuleNode|.
nsRuleNode* const mRuleNode;
// Private to nsStyleContext::Alloc and FreeAllocations.
struct AllocationHeader {
AllocationHeader* mNext;
size_t mSize;
void* mStorageStart; // ensure the storage is at least pointer-aligned
};
AllocationHeader* mAllocations;
// mCachedInheritedData and mCachedResetData point to both structs that
// are owned by this style context and structs that are owned by one of
// this style context's ancestors (which are indirectly owned since this