mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 10:08:41 +00:00
bug 735647 - use larger buffers for key strings in ReflowCountMgr, and fix leakage & allocator mismatch. r=matspal
This commit is contained in:
parent
f28682b3c8
commit
96d2b41275
@ -8540,6 +8540,9 @@ void ReflowCounter::DisplayHTMLTotals(PRUint32 aTotal, const char * aTitle)
|
||||
//------------------------------------------------------------------
|
||||
//-- ReflowCountMgr
|
||||
//------------------------------------------------------------------
|
||||
|
||||
#define KEY_BUF_SIZE_FOR_PTR 24 // adequate char[] buffer to sprintf a pointer
|
||||
|
||||
ReflowCountMgr::ReflowCountMgr()
|
||||
{
|
||||
mCounts = PL_NewHashTable(10, PL_HashString, PL_CompareStrings,
|
||||
@ -8588,14 +8591,14 @@ void ReflowCountMgr::Add(const char * aName, nsIFrame * aFrame)
|
||||
if ((mDumpFrameByFrameCounts || mPaintFrameByFrameCounts) &&
|
||||
nsnull != mIndiFrameCounts &&
|
||||
aFrame != nsnull) {
|
||||
char * key = new char[16];
|
||||
char key[KEY_BUF_SIZE_FOR_PTR];
|
||||
sprintf(key, "%p", (void*)aFrame);
|
||||
IndiReflowCounter * counter = (IndiReflowCounter *)PL_HashTableLookup(mIndiFrameCounts, key);
|
||||
if (counter == nsnull) {
|
||||
counter = new IndiReflowCounter(this);
|
||||
counter->mFrame = aFrame;
|
||||
counter->mName.AssignASCII(aName);
|
||||
PL_HashTableAdd(mIndiFrameCounts, key, counter);
|
||||
PL_HashTableAdd(mIndiFrameCounts, NS_strdup(key), counter);
|
||||
}
|
||||
// this eliminates extra counts from super classes
|
||||
if (counter != nsnull && counter->mName.EqualsASCII(aName)) {
|
||||
@ -8616,7 +8619,7 @@ void ReflowCountMgr::PaintCount(const char* aName,
|
||||
if (mPaintFrameByFrameCounts &&
|
||||
nsnull != mIndiFrameCounts &&
|
||||
aFrame != nsnull) {
|
||||
char * key = new char[16];
|
||||
char key[KEY_BUF_SIZE_FOR_PTR];
|
||||
sprintf(key, "%p", (void*)aFrame);
|
||||
IndiReflowCounter * counter =
|
||||
(IndiReflowCounter *)PL_HashTableLookup(mIndiFrameCounts, key);
|
||||
@ -8753,7 +8756,7 @@ static void RecurseIndiTotals(nsPresContext* aPresContext,
|
||||
return;
|
||||
}
|
||||
|
||||
char key[16];
|
||||
char key[KEY_BUF_SIZE_FOR_PTR];
|
||||
sprintf(key, "%p", (void*)aParentFrame);
|
||||
IndiReflowCounter * counter = (IndiReflowCounter *)PL_HashTableLookup(aHT, key);
|
||||
if (counter) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user