From b4e0c1e9de9abb3c53f479b07758da3bc4a14b81 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 27 Mar 2015 09:10:32 +0900 Subject: [PATCH] Bug 1134920 - Remove nsMemory::Alloc/Realloc/Free. r=nfroyd --- xpcom/base/nsIMemory.idl | 36 +----------------------------------- xpcom/base/nsMemoryImpl.cpp | 18 ------------------ xpcom/glue/nsMemory.h | 15 --------------- 3 files changed, 1 insertion(+), 68 deletions(-) diff --git a/xpcom/base/nsIMemory.idl b/xpcom/base/nsIMemory.idl index eac430d1101..a474a5b2909 100644 --- a/xpcom/base/nsIMemory.idl +++ b/xpcom/base/nsIMemory.idl @@ -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 diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp index 5f46c4532a4..0d619a37c1c 100644 --- a/xpcom/base/nsMemoryImpl.cpp +++ b/xpcom/base/nsMemoryImpl.cpp @@ -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) { diff --git a/xpcom/glue/nsMemory.h b/xpcom/glue/nsMemory.h index ac3495fb9ab..ca0d8890977 100644 --- a/xpcom/glue/nsMemory.h +++ b/xpcom/glue/nsMemory.h @@ -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