Bug 6665. Hack to addref resources before doing the sort. This saves mailnews from having to recreate them.

This commit is contained in:
waterson%netscape.com 1999-06-16 02:07:56 +00:00
Родитель 912dc7a410
Коммит 8a37a5afc1
2 изменённых файлов: 42 добавлений и 0 удалений

Просмотреть файл

@ -1032,6 +1032,17 @@ XULSortServiceImpl::SortTreeChildren(nsIContent *container, PRInt32 colIndex, so
inplaceSortCallback, (void *)sortInfo);
}
// Bug 6665. This is a hack to "addref" the resources
// before we remove them from the content model. This
// keeps them from getting released, which causes
// performance problems for some datasources.
for (loop = 0; loop < numElements; loop++)
{
nsIRDFResource* resource;
nsRDFContentUtils::GetElementResource(flatArray[loop], &resource);
// Note that we don't release; see part deux below...
}
RemoveAllChildren(container);
if (NS_FAILED(rv = container->UnsetAttribute(kNameSpaceID_None,
kTreeContentsGeneratedAtom,
@ -1047,6 +1058,16 @@ XULSortServiceImpl::SortTreeChildren(nsIContent *container, PRInt32 colIndex, so
container->InsertChildAt((nsIContent *)flatArray[loop], numChildren++, PR_FALSE);
}
// Bug 6665, part deux. The Big Hack.
for (loop = 0; loop < numElements; loop++)
{
nsIRDFResource* resource;
nsRDFContentUtils::GetElementResource(flatArray[loop], &resource);
nsrefcnt refcnt;
NS_RELEASE2(resource, refcnt);
NS_RELEASE(resource);
}
// recurse on grandchildren
for (loop=0; loop<numElements; loop++)
{

Просмотреть файл

@ -1032,6 +1032,17 @@ XULSortServiceImpl::SortTreeChildren(nsIContent *container, PRInt32 colIndex, so
inplaceSortCallback, (void *)sortInfo);
}
// Bug 6665. This is a hack to "addref" the resources
// before we remove them from the content model. This
// keeps them from getting released, which causes
// performance problems for some datasources.
for (loop = 0; loop < numElements; loop++)
{
nsIRDFResource* resource;
nsRDFContentUtils::GetElementResource(flatArray[loop], &resource);
// Note that we don't release; see part deux below...
}
RemoveAllChildren(container);
if (NS_FAILED(rv = container->UnsetAttribute(kNameSpaceID_None,
kTreeContentsGeneratedAtom,
@ -1047,6 +1058,16 @@ XULSortServiceImpl::SortTreeChildren(nsIContent *container, PRInt32 colIndex, so
container->InsertChildAt((nsIContent *)flatArray[loop], numChildren++, PR_FALSE);
}
// Bug 6665, part deux. The Big Hack.
for (loop = 0; loop < numElements; loop++)
{
nsIRDFResource* resource;
nsRDFContentUtils::GetElementResource(flatArray[loop], &resource);
nsrefcnt refcnt;
NS_RELEASE2(resource, refcnt);
NS_RELEASE(resource);
}
// recurse on grandchildren
for (loop=0; loop<numElements; loop++)
{