renamed nsAllocator to nsAllocatorImpl and NSTaskMem to nsAllocator

git-svn-id: svn://10.0.0.236/trunk@26025 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jband%netscape.com
1999-04-02 06:17:28 +00:00
parent 4f08c2ac87
commit 3526c9d762
7 changed files with 48 additions and 48 deletions

View File

@@ -27,19 +27,19 @@
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIAllocatorIID, NS_IALLOCATOR_IID);
nsAllocator::nsAllocator(nsISupports* outer)
nsAllocatorImpl::nsAllocatorImpl(nsISupports* outer)
{
NS_INIT_AGGREGATED(outer);
}
nsAllocator::~nsAllocator(void)
nsAllocatorImpl::~nsAllocatorImpl(void)
{
}
NS_IMPL_AGGREGATED(nsAllocator);
NS_IMPL_AGGREGATED(nsAllocatorImpl);
NS_METHOD
nsAllocator::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
nsAllocatorImpl::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
@@ -54,11 +54,11 @@ nsAllocator::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
}
NS_METHOD
nsAllocator::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
nsAllocatorImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
{
if (outer && !aIID.Equals(kISupportsIID))
return NS_NOINTERFACE; // XXX right error?
nsAllocator* mm = new nsAllocator(outer);
nsAllocatorImpl* mm = new nsAllocatorImpl(outer);
if (mm == NULL)
return NS_ERROR_OUT_OF_MEMORY;
mm->AddRef();
@@ -72,26 +72,26 @@ nsAllocator::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
////////////////////////////////////////////////////////////////////////////////
NS_METHOD_(void*)
nsAllocator::Alloc(PRUint32 size)
nsAllocatorImpl::Alloc(PRUint32 size)
{
return PR_Malloc(size);
}
NS_METHOD_(void*)
nsAllocator::Realloc(void* ptr, PRUint32 size)
nsAllocatorImpl::Realloc(void* ptr, PRUint32 size)
{
return PR_Realloc(ptr, size);
}
NS_METHOD
nsAllocator::Free(void* ptr)
nsAllocatorImpl::Free(void* ptr)
{
PR_Free(ptr);
return NS_OK;
}
NS_METHOD
nsAllocator::HeapMinimize(void)
nsAllocatorImpl::HeapMinimize(void)
{
#ifdef XP_MAC
// This used to live in the memory allocators no Mac, but does no more
@@ -119,7 +119,7 @@ nsAllocatorFactory::CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult)
{
return nsAllocator::Create(aOuter, aIID, aResult);
return nsAllocatorImpl::Create(aOuter, aIID, aResult);
}
NS_METHOD
@@ -136,31 +136,31 @@ nsAllocatorFactory::LockFactory(PRBool aLock)
*/
// public:
void* NSTaskMem::Alloc(PRUint32 size)
void* nsAllocator::Alloc(PRUint32 size)
{
if(!EnsureAllocator()) return NULL;
return mAllocator->Alloc(size);
}
void* NSTaskMem::Realloc(void* ptr, PRUint32 size)
void* nsAllocator::Realloc(void* ptr, PRUint32 size)
{
if(!EnsureAllocator()) return NULL;
return mAllocator->Realloc(ptr, size);
}
void NSTaskMem::Free(void* ptr)
void nsAllocator::Free(void* ptr)
{
if(!EnsureAllocator()) return;
mAllocator->Free(ptr);
}
void NSTaskMem::HeapMinimize()
void nsAllocator::HeapMinimize()
{
if(!EnsureAllocator()) return;
mAllocator->HeapMinimize();
}
void* NSTaskMem::Clone(const void* ptr, PRUint32 size)
void* nsAllocator::Clone(const void* ptr, PRUint32 size)
{
if(!ptr || !EnsureAllocator()) return NULL;
void* p = mAllocator->Alloc(size);
@@ -170,9 +170,9 @@ void* NSTaskMem::Clone(const void* ptr, PRUint32 size)
// private:
nsIAllocator* NSTaskMem::mAllocator = NULL;
nsIAllocator* nsAllocator::mAllocator = NULL;
PRBool NSTaskMem::FetchAllocator()
PRBool nsAllocator::FetchAllocator()
{
NS_DEFINE_IID(kAllocatorCID, NS_ALLOCATOR_CID);
NS_DEFINE_IID(kIAllocatorIID, NS_IALLOCATOR_IID);

View File

@@ -28,7 +28,7 @@
#include "nsAgg.h"
#include "nsIFactory.h"
class nsAllocator : public nsIAllocator {
class nsAllocatorImpl : public nsIAllocator {
public:
static const nsCID& CID() { static nsCID cid = NS_ALLOCATOR_CID; return cid; }
@@ -63,8 +63,8 @@ public:
////////////////////////////////////////////////////////////////////////////
nsAllocator(nsISupports* outer);
virtual ~nsAllocator(void);
nsAllocatorImpl(nsISupports* outer);
virtual ~nsAllocatorImpl(void);
NS_DECL_AGGREGATED

View File

@@ -82,7 +82,7 @@ public:
* Public shortcuts to the shared allocator's methods
*/
class NSTaskMem
class nsAllocator
{
public:
static NS_EXPORT void* Alloc(PRUint32 size);
@@ -91,7 +91,7 @@ public:
static NS_EXPORT void HeapMinimize();
static NS_EXPORT void* Clone(const void* ptr, PRUint32 size);
private:
NSTaskMem(); // not implemented
nsAllocator(); // not implemented
static PRBool EnsureAllocator() {return mAllocator || FetchAllocator();}
static PRBool FetchAllocator();
static nsIAllocator* mAllocator;

View File

@@ -82,7 +82,7 @@ public:
* Public shortcuts to the shared allocator's methods
*/
class NSTaskMem
class nsAllocator
{
public:
static NS_EXPORT void* Alloc(PRUint32 size);
@@ -91,7 +91,7 @@ public:
static NS_EXPORT void HeapMinimize();
static NS_EXPORT void* Clone(const void* ptr, PRUint32 size);
private:
NSTaskMem(); // not implemented
nsAllocator(); // not implemented
static PRBool EnsureAllocator() {return mAllocator || FetchAllocator();}
static PRBool FetchAllocator();
static nsIAllocator* mAllocator;

View File

@@ -27,19 +27,19 @@
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIAllocatorIID, NS_IALLOCATOR_IID);
nsAllocator::nsAllocator(nsISupports* outer)
nsAllocatorImpl::nsAllocatorImpl(nsISupports* outer)
{
NS_INIT_AGGREGATED(outer);
}
nsAllocator::~nsAllocator(void)
nsAllocatorImpl::~nsAllocatorImpl(void)
{
}
NS_IMPL_AGGREGATED(nsAllocator);
NS_IMPL_AGGREGATED(nsAllocatorImpl);
NS_METHOD
nsAllocator::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
nsAllocatorImpl::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
@@ -54,11 +54,11 @@ nsAllocator::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
}
NS_METHOD
nsAllocator::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
nsAllocatorImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
{
if (outer && !aIID.Equals(kISupportsIID))
return NS_NOINTERFACE; // XXX right error?
nsAllocator* mm = new nsAllocator(outer);
nsAllocatorImpl* mm = new nsAllocatorImpl(outer);
if (mm == NULL)
return NS_ERROR_OUT_OF_MEMORY;
mm->AddRef();
@@ -72,26 +72,26 @@ nsAllocator::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
////////////////////////////////////////////////////////////////////////////////
NS_METHOD_(void*)
nsAllocator::Alloc(PRUint32 size)
nsAllocatorImpl::Alloc(PRUint32 size)
{
return PR_Malloc(size);
}
NS_METHOD_(void*)
nsAllocator::Realloc(void* ptr, PRUint32 size)
nsAllocatorImpl::Realloc(void* ptr, PRUint32 size)
{
return PR_Realloc(ptr, size);
}
NS_METHOD
nsAllocator::Free(void* ptr)
nsAllocatorImpl::Free(void* ptr)
{
PR_Free(ptr);
return NS_OK;
}
NS_METHOD
nsAllocator::HeapMinimize(void)
nsAllocatorImpl::HeapMinimize(void)
{
#ifdef XP_MAC
// This used to live in the memory allocators no Mac, but does no more
@@ -119,7 +119,7 @@ nsAllocatorFactory::CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult)
{
return nsAllocator::Create(aOuter, aIID, aResult);
return nsAllocatorImpl::Create(aOuter, aIID, aResult);
}
NS_METHOD
@@ -136,31 +136,31 @@ nsAllocatorFactory::LockFactory(PRBool aLock)
*/
// public:
void* NSTaskMem::Alloc(PRUint32 size)
void* nsAllocator::Alloc(PRUint32 size)
{
if(!EnsureAllocator()) return NULL;
return mAllocator->Alloc(size);
}
void* NSTaskMem::Realloc(void* ptr, PRUint32 size)
void* nsAllocator::Realloc(void* ptr, PRUint32 size)
{
if(!EnsureAllocator()) return NULL;
return mAllocator->Realloc(ptr, size);
}
void NSTaskMem::Free(void* ptr)
void nsAllocator::Free(void* ptr)
{
if(!EnsureAllocator()) return;
mAllocator->Free(ptr);
}
void NSTaskMem::HeapMinimize()
void nsAllocator::HeapMinimize()
{
if(!EnsureAllocator()) return;
mAllocator->HeapMinimize();
}
void* NSTaskMem::Clone(const void* ptr, PRUint32 size)
void* nsAllocator::Clone(const void* ptr, PRUint32 size)
{
if(!ptr || !EnsureAllocator()) return NULL;
void* p = mAllocator->Alloc(size);
@@ -170,9 +170,9 @@ void* NSTaskMem::Clone(const void* ptr, PRUint32 size)
// private:
nsIAllocator* NSTaskMem::mAllocator = NULL;
nsIAllocator* nsAllocator::mAllocator = NULL;
PRBool NSTaskMem::FetchAllocator()
PRBool nsAllocator::FetchAllocator()
{
NS_DEFINE_IID(kAllocatorCID, NS_ALLOCATOR_CID);
NS_DEFINE_IID(kIAllocatorIID, NS_IALLOCATOR_IID);

View File

@@ -28,7 +28,7 @@
#include "nsAgg.h"
#include "nsIFactory.h"
class nsAllocator : public nsIAllocator {
class nsAllocatorImpl : public nsIAllocator {
public:
static const nsCID& CID() { static nsCID cid = NS_ALLOCATOR_CID; return cid; }
@@ -63,8 +63,8 @@ public:
////////////////////////////////////////////////////////////////////////////
nsAllocator(nsISupports* outer);
virtual ~nsAllocator(void);
nsAllocatorImpl(nsISupports* outer);
virtual ~nsAllocatorImpl(void);
NS_DECL_AGGREGATED

View File

@@ -54,8 +54,8 @@ NSGetFactory(nsISupports* serviceMgr,
} else {
// Use generic factories for the rest.
nsGenericFactory* factory = NULL;
if (aClass.Equals(nsAllocator::CID())) {
factory = new nsGenericFactory(&nsAllocator::Create);
if (aClass.Equals(nsAllocatorImpl::CID())) {
factory = new nsGenericFactory(&nsAllocatorImpl::Create);
} else if (aClass.Equals(nsGenericFactory::CID())) {
// whoa, create a generic factory that creates generic factories!
factory = new nsGenericFactory(&nsGenericFactory::Create);