Bug 1134920 - Remove nsMemory::Alloc/Realloc/Free. r=nfroyd

This commit is contained in:
Mike Hommey 2015-03-27 09:10:32 +09:00
parent ee117642af
commit b4e0c1e9de
3 changed files with 1 additions and 68 deletions

View File

@ -47,43 +47,9 @@
* realloc() has failed.
*/
[scriptable, uuid(6aef11c4-8615-44a6-9711-98f43805693d)]
[scriptable, uuid(1e004834-6d8f-425a-bc9c-a2812ed43bb7)]
interface nsIMemory : nsISupports
{
/**
* Allocates a block of memory of a particular size. If the memory
* cannot be allocated (because of an out-of-memory condition), the
* process aborts.
*
* @param size - the size of the block to allocate
* @result the block of memory
*/
[noscript, notxpcom] voidPtr alloc(in size_t size);
/**
* Reallocates a block of memory to a new size.
*
* @param ptr - the block of memory to reallocate
* @param size - the new size
* @result the reallocated block of memory
*
* If ptr is null, this function behaves like malloc.
* If s is the size of the block to which ptr points, the first
* min(s, size) bytes of ptr's block are copied to the new block.
* If the allocation succeeds, ptr is freed and a pointer to the
* new block returned. If the allocation fails, the process aborts.
*/
[noscript, notxpcom] voidPtr realloc(in voidPtr ptr,
in size_t newSize);
/**
* Frees a block of memory. Null is a permissible value, in which case
* nothing happens.
*
* @param ptr - the block of memory to free
*/
[noscript, notxpcom] void free(in voidPtr ptr);
/**
* Attempts to shrink the heap.
* @param immediate - if true, heap minimization will occur

View File

@ -28,24 +28,6 @@ static nsMemoryImpl sGlobalMemory;
NS_IMPL_QUERY_INTERFACE(nsMemoryImpl, nsIMemory)
NS_IMETHODIMP_(void*)
nsMemoryImpl::Alloc(size_t aSize)
{
return NS_Alloc(aSize);
}
NS_IMETHODIMP_(void*)
nsMemoryImpl::Realloc(void* aPtr, size_t aSize)
{
return NS_Realloc(aPtr, aSize);
}
NS_IMETHODIMP_(void)
nsMemoryImpl::Free(void* aPtr)
{
NS_Free(aPtr);
}
NS_IMETHODIMP
nsMemoryImpl::HeapMinimize(bool aImmediate)
{

View File

@ -33,21 +33,6 @@ class nsIMemory;
class nsMemory
{
public:
static NS_HIDDEN_(void*) Alloc(size_t aSize)
{
return NS_Alloc(aSize);
}
static NS_HIDDEN_(void*) Realloc(void* aPtr, size_t aSize)
{
return NS_Realloc(aPtr, aSize);
}
static NS_HIDDEN_(void) Free(void* aPtr)
{
NS_Free(aPtr);
}
static nsresult HeapMinimize(bool aImmediate);
static void* Clone(const void* aPtr, size_t aSize);
static nsIMemory* GetGlobalMemoryService(); // AddRefs