Avoid checking for duplicates when adding a context to the cache (perf. reasons). b=72217, r=jag, sr=brendan

This commit is contained in:
attinasi%netscape.com 2001-03-28 19:58:51 +00:00
Родитель 1673b3f16f
Коммит c572186d99
2 изменённых файлов: 8 добавлений и 22 удалений

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

@ -1572,19 +1572,12 @@ nsresult StyleContextCache::AddContext(scKey aKey, nsIStyleContext *aContext)
nsVoidArray *pList = GetList(aKey); nsVoidArray *pList = GetList(aKey);
NS_ASSERTION(pList != nsnull, "VerifyList failed me!"); NS_ASSERTION(pList != nsnull, "VerifyList failed me!");
NS_ASSERTION(pList->IndexOf(aContext) == -1, "Context already in list"); NS_ASSERTION(pList->IndexOf(aContext) == -1, "Context already in list");
if(pList->IndexOf(aContext) == -1){
if (!(pList->AppendElement(aContext))) { if (!(pList->AppendElement(aContext))) {
rv = NS_ERROR_FAILURE; rv = NS_ERROR_FAILURE;
} else { } else {
mCount++; mCount++;
} }
DumpStats(); DumpStats();
} else {
#ifdef DEBUG
printf( "Context already in list in StyleContextCache::AddContext\n");
#endif
rv = NS_ERROR_FAILURE;
}
} }
return rv; return rv;
} }

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

@ -1572,19 +1572,12 @@ nsresult StyleContextCache::AddContext(scKey aKey, nsIStyleContext *aContext)
nsVoidArray *pList = GetList(aKey); nsVoidArray *pList = GetList(aKey);
NS_ASSERTION(pList != nsnull, "VerifyList failed me!"); NS_ASSERTION(pList != nsnull, "VerifyList failed me!");
NS_ASSERTION(pList->IndexOf(aContext) == -1, "Context already in list"); NS_ASSERTION(pList->IndexOf(aContext) == -1, "Context already in list");
if(pList->IndexOf(aContext) == -1){
if (!(pList->AppendElement(aContext))) { if (!(pList->AppendElement(aContext))) {
rv = NS_ERROR_FAILURE; rv = NS_ERROR_FAILURE;
} else { } else {
mCount++; mCount++;
} }
DumpStats(); DumpStats();
} else {
#ifdef DEBUG
printf( "Context already in list in StyleContextCache::AddContext\n");
#endif
rv = NS_ERROR_FAILURE;
}
} }
return rv; return rv;
} }