зеркало из https://github.com/mozilla/pjs.git
Avoid checking for duplicates when adding a context to the cache (perf. reasons). b=72217, r=jag, sr=brendan
This commit is contained in:
Родитель
1673b3f16f
Коммит
c572186d99
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче