Adds a nsCOMArray version of a function in the annotation service, and

changes some code in nsLivemarkService::Init to use it, which gets rid
of a handful of nsSimpleURI reference leaks when using the LivemarkService.

bug=333784
r=brettw@google.com
sr=bryner@brianryner.com

Original committer: joe%retrovirus.com
Original revision: 1.20
Original date: 2006/04/13 03:05:50
This commit is contained in:
benjamin%smedbergs.us 2006-07-18 15:18:22 +00:00
Родитель cca94172b2
Коммит ac6ef1783b
1 изменённых файлов: 5 добавлений и 9 удалений

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

@ -170,17 +170,15 @@ nsLivemarkService::Init()
pRDF->GetResource(NS_LITERAL_CSTRING(DC_NAMESPACE_URI "date"),
getter_AddRefs(mLMDC_date));
// Initialize the list of livemarks from the list of URIs
// that have a feed uri annotation.
nsIURI ** pLivemarks;
PRUint32 numLivemarks;
rv = mAnnotationService->GetPagesWithAnnotation(NS_LITERAL_CSTRING(LMANNO_FEEDURI),
&numLivemarks,
&pLivemarks);
nsCOMArray<nsIURI> pLivemarks;
rv = mAnnotationService->GetPagesWithAnnotationCOMArray(
NS_LITERAL_CSTRING(LMANNO_FEEDURI), &pLivemarks);
NS_ENSURE_SUCCESS(rv, rv);
for (PRUint32 i = 0; i < numLivemarks; ++i) {
for (PRInt32 i = 0; i < pLivemarks.Count(); ++i) {
// Get the feed URI from the annotation.
nsAutoString feedURIString;
@ -213,8 +211,6 @@ nsLivemarkService::Init()
NS_ENSURE_TRUE(li, NS_ERROR_OUT_OF_MEMORY);
NS_ENSURE_TRUE(mLivemarks.AppendElement(li), NS_ERROR_OUT_OF_MEMORY);
}
if (numLivemarks > 0)
nsMemory::Free(pLivemarks);
return rv;
}