mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-14 15:30:07 +00:00
#415: M1376936 M1375331
This commit is contained in:
parent
ec23e34e98
commit
33344c6445
|
@ -92,7 +92,8 @@ NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsBaseContentList)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsBaseContentList)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsBaseContentList)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(nsBaseContentList,
|
||||||
|
LastRelease())
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -612,6 +613,17 @@ nsContentList::NodeWillBeDestroyed(const nsINode* aNode)
|
||||||
SetDirty();
|
SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsContentList::LastRelease()
|
||||||
|
{
|
||||||
|
RemoveFromCaches();
|
||||||
|
if (mRootNode) {
|
||||||
|
mRootNode->RemoveMutationObserver(this);
|
||||||
|
mRootNode = nullptr;
|
||||||
|
}
|
||||||
|
SetDirty();
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsContentList::GetLength(uint32_t* aLength)
|
nsContentList::GetLength(uint32_t* aLength)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,6 +95,9 @@ public:
|
||||||
{
|
{
|
||||||
mElements.SetCapacity(aCapacity);
|
mElements.SetCapacity(aCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void LastRelease() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsBaseContentList();
|
virtual ~nsBaseContentList();
|
||||||
|
|
||||||
|
@ -348,6 +351,8 @@ public:
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void LastRelease() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Returns whether the element matches our criterion
|
* Returns whether the element matches our criterion
|
||||||
|
|
|
@ -131,9 +131,17 @@ nsPresArena::Allocate(uint32_t aCode, size_t aSize)
|
||||||
|
|
||||||
void* result;
|
void* result;
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
// LIFO behavior for best cache utilization
|
// Remove from the end of the mEntries array to avoid memmoving entries,
|
||||||
|
// and use SetLengthAndRetainStorage to avoid a lot of malloc/free
|
||||||
|
// from ShrinkCapacity on smaller sizes. 500 pointers means the malloc size
|
||||||
|
// for the array is 4096 bytes or more on a 64-bit system. The next smaller
|
||||||
|
// size is 2048 (with jemalloc), which we consider not worth compacting.
|
||||||
result = list->mEntries.ElementAt(len - 1);
|
result = list->mEntries.ElementAt(len - 1);
|
||||||
list->mEntries.RemoveElementAt(len - 1);
|
if (list->mEntries.Capacity() > 500) {
|
||||||
|
list->mEntries.RemoveElementAt(len - 1);
|
||||||
|
} else {
|
||||||
|
list->mEntries.SetLengthAndRetainStorage(len - 1);
|
||||||
|
}
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
{
|
{
|
||||||
MOZ_MAKE_MEM_DEFINED(result, list->mEntrySize);
|
MOZ_MAKE_MEM_DEFINED(result, list->mEntrySize);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user