зеркало из https://github.com/mozilla/pjs.git
augh, didn't mean to check these in
This commit is contained in:
Родитель
b1110a867c
Коммит
9a165b9999
|
@ -156,13 +156,9 @@ protected:
|
|||
FindBucket(size_t aSize);
|
||||
|
||||
public:
|
||||
nsFixedSizeAllocator() : mBuckets(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsFixedSizeAllocator);
|
||||
}
|
||||
nsFixedSizeAllocator() : mBuckets(nsnull) {}
|
||||
|
||||
~nsFixedSizeAllocator() {
|
||||
MOZ_COUNT_DTOR(nsFixedSizeAllocator);
|
||||
if (mBuckets)
|
||||
PL_FinishArenaPool(&mPool);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
#include "plarena.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// These functions really should be part of nspr, and have internal knowledge
|
||||
|
@ -165,10 +164,6 @@ static void PR_CALLBACK _hashFreeTable(void *pool, void *item) {
|
|||
}
|
||||
|
||||
static PLHashEntry * PR_CALLBACK _hashAllocEntry(void *pool, const void *key) {
|
||||
if (pool) {
|
||||
return (PLHashEntry*)((nsFixedSizeAllocator*)pool)->Alloc(sizeof(PLHashEntry));
|
||||
}
|
||||
|
||||
return PR_NEW(PLHashEntry);
|
||||
}
|
||||
|
||||
|
@ -177,11 +172,7 @@ static void PR_CALLBACK _hashFreeEntry(void *pool, PLHashEntry *entry,
|
|||
{
|
||||
if (flag == HT_FREE_ENTRY) {
|
||||
delete (nsHashKey *) (entry->key);
|
||||
if (pool) {
|
||||
((nsFixedSizeAllocator*)pool)->Free((void*)entry, sizeof(PLHashEntry));
|
||||
}
|
||||
else
|
||||
PR_DELETE(entry);
|
||||
PR_DELETE(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,22 +220,13 @@ nsHashtable::nsHashtable(PRUint32 aInitSize, PRBool threadSafe)
|
|||
: mLock(NULL), mEnumerating(PR_FALSE)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHashtable);
|
||||
|
||||
static const size_t kBucketSizes[] =
|
||||
{ sizeof(PLHashEntry) };
|
||||
static const PRInt32 kNumBucketSizes =
|
||||
sizeof(kBucketSizes) / sizeof(size_t);
|
||||
|
||||
mPool.Init("hashFoo", kBucketSizes, kNumBucketSizes,
|
||||
sizeof(PLHashEntry)*aInitSize);
|
||||
|
||||
PRStatus status = PL_HashTableInit(&mHashtable,
|
||||
aInitSize,
|
||||
_hashValue,
|
||||
_hashKeyCompare,
|
||||
_hashValueCompare,
|
||||
&_hashAllocOps,
|
||||
(void*)&mPool);
|
||||
NULL);
|
||||
PR_ASSERT(status == PR_SUCCESS);
|
||||
if (threadSafe) {
|
||||
mLock = PR_NewLock();
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
#include "nsCom.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsFixedSizeAllocator.h"
|
||||
|
||||
class nsIObjectInputStream;
|
||||
class nsIObjectOutputStream;
|
||||
|
||||
|
@ -109,7 +107,6 @@ class NS_COM nsHashtable {
|
|||
PRLock* mLock;
|
||||
PLHashTable mHashtable;
|
||||
PRBool mEnumerating;
|
||||
nsFixedSizeAllocator mPool;
|
||||
|
||||
public:
|
||||
nsHashtable(PRUint32 aSize = 16, PRBool threadSafe = PR_FALSE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче