mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Added GetGlobalAllocator.
This commit is contained in:
parent
8f5b13ed87
commit
0d2bbb1e6a
@ -165,7 +165,15 @@ void* nsAllocator::Clone(const void* ptr, PRUint32 size)
|
||||
void* p = mAllocator->Alloc(size);
|
||||
if(p) memcpy(p, ptr, size);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
NS_EXPORT nsIAllocator*
|
||||
nsAllocator::GetGlobalAllocator()
|
||||
{
|
||||
if(!EnsureAllocator()) return nsnull;
|
||||
NS_ADDREF(mAllocator);
|
||||
return mAllocator;
|
||||
}
|
||||
|
||||
// private:
|
||||
|
||||
|
@ -95,6 +95,7 @@ public:
|
||||
static NS_EXPORT void Free(void* ptr);
|
||||
static NS_EXPORT void HeapMinimize();
|
||||
static NS_EXPORT void* Clone(const void* ptr, PRUint32 size);
|
||||
static NS_EXPORT nsIAllocator* GetGlobalAllocator();
|
||||
private:
|
||||
nsAllocator(); // not implemented
|
||||
static PRBool EnsureAllocator() {return mAllocator || FetchAllocator();}
|
||||
|
Loading…
Reference in New Issue
Block a user