Bug 1130142, part 3 - Use HashNumber method in more places in trace refcounting. r=froydnj

This should not change any behavior.
This commit is contained in:
Andrew McCreight 2015-02-20 09:38:47 -08:00
Родитель 138983aa4c
Коммит af29279350
1 изменённых файлов: 10 добавлений и 10 удалений

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

@ -645,11 +645,17 @@ LogThisType(const char* aTypeName)
return he != nullptr;
}
static PLHashNumber
HashNumber(const void* aKey)
{
return PLHashNumber(NS_PTR_TO_INT32(aKey));
}
static intptr_t
GetSerialNumber(void* aPtr, bool aCreate)
{
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
PLHashNumber(NS_PTR_TO_INT32(aPtr)),
HashNumber(aPtr),
aPtr);
if (hep && *hep) {
return reinterpret_cast<serialNumberRecord*>((*hep)->value)->serialNumber;
@ -658,7 +664,7 @@ GetSerialNumber(void* aPtr, bool aCreate)
record->serialNumber = ++gNextSerialNumber;
record->refCount = 0;
record->COMPtrCount = 0;
PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)),
PL_HashTableRawAdd(gSerialNumbers, hep, HashNumber(aPtr),
aPtr, reinterpret_cast<void*>(record));
return gNextSerialNumber;
}
@ -669,7 +675,7 @@ static int32_t*
GetRefCount(void* aPtr)
{
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
PLHashNumber(NS_PTR_TO_INT32(aPtr)),
HashNumber(aPtr),
aPtr);
if (hep && *hep) {
return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->refCount);
@ -683,7 +689,7 @@ static int32_t*
GetCOMPtrCount(void* aPtr)
{
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
PLHashNumber(NS_PTR_TO_INT32(aPtr)),
HashNumber(aPtr),
aPtr);
if (hep && *hep) {
return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->COMPtrCount);
@ -759,12 +765,6 @@ InitLog(const char* aEnvVar, const char* aMsg, FILE** aResult)
}
static PLHashNumber
HashNumber(const void* aKey)
{
return PLHashNumber(NS_PTR_TO_INT32(aKey));
}
static void
maybeUnregisterAndCloseFile(FILE*& aFile)
{