summaryrefslogtreecommitdiffstats
path: root/memory
diff options
context:
space:
mode:
Diffstat (limited to 'memory')
-rw-r--r--memory/build/moz.build2
-rw-r--r--memory/build/mozmemory_wrap.c54
-rw-r--r--memory/build/mozmemory_wrap.h25
-rw-r--r--memory/build/replace_malloc.c25
-rw-r--r--memory/build/replace_malloc.h2
-rw-r--r--memory/mozalloc/mozalloc.h11
-rw-r--r--memory/mozalloc/mozalloc_abort.cpp37
-rw-r--r--memory/mozjemalloc/jemalloc.c19
-rw-r--r--memory/replace/logalloc/LogAlloc.cpp10
-rw-r--r--memory/replace/logalloc/moz.build18
-rw-r--r--memory/replace/logalloc/replay/Replay.cpp17
-rw-r--r--memory/volatile/VolatileBuffer.h4
-rw-r--r--memory/volatile/VolatileBufferAshmem.cpp139
-rw-r--r--memory/volatile/moz.build22
-rw-r--r--memory/volatile/tests/TestVolatileBuffer.cpp8
15 files changed, 19 insertions, 374 deletions
diff --git a/memory/build/moz.build b/memory/build/moz.build
index f4fd82878..c43e85192 100644
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -36,6 +36,6 @@ if CONFIG['MOZ_GLUE_IN_PROGRAM']:
DIST_INSTALL = True
# Keep jemalloc separated when mozglue is statically linked
-if CONFIG['MOZ_MEMORY'] and CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'):
+if CONFIG['MOZ_MEMORY'] and CONFIG['OS_TARGET'] in ('WINNT', 'Darwin'):
FINAL_LIBRARY = 'mozglue'
diff --git a/memory/build/mozmemory_wrap.c b/memory/build/mozmemory_wrap.c
index dba3ace56..fdb8447d3 100644
--- a/memory/build/mozmemory_wrap.c
+++ b/memory/build/mozmemory_wrap.c
@@ -88,60 +88,6 @@ strdup_impl(const char *src)
}
#endif /* XP_DARWIN */
-#ifdef ANDROID
-#include <stdarg.h>
-#include <stdio.h>
-
-MOZ_MEMORY_API int
-vasprintf_impl(char **str, const char *fmt, va_list ap)
-{
- char* ptr, *_ptr;
- int ret;
-
- if (str == NULL || fmt == NULL) {
- return -1;
- }
-
- ptr = (char*)malloc_impl(128);
- if (ptr == NULL) {
- *str = NULL;
- return -1;
- }
-
- ret = vsnprintf(ptr, 128, fmt, ap);
- if (ret < 0) {
- free_impl(ptr);
- *str = NULL;
- return -1;
- }
-
- _ptr = realloc_impl(ptr, ret + 1);
- if (_ptr == NULL) {
- free_impl(ptr);
- *str = NULL;
- return -1;
- }
-
- *str = _ptr;
-
- return ret;
-}
-
-MOZ_MEMORY_API int
-asprintf_impl(char **str, const char *fmt, ...)
-{
- int ret;
- va_list ap;
- va_start(ap, fmt);
-
- ret = vasprintf_impl(str, fmt, ap);
-
- va_end(ap);
-
- return ret;
-}
-#endif
-
#ifdef XP_WIN
/*
* There's a fun allocator mismatch in (at least) the VS 2010 CRT
diff --git a/memory/build/mozmemory_wrap.h b/memory/build/mozmemory_wrap.h
index bb1d339ba..da4fd27bb 100644
--- a/memory/build/mozmemory_wrap.h
+++ b/memory/build/mozmemory_wrap.h
@@ -58,13 +58,8 @@
* zone allocator anyways. Jemalloc-specific functions are also left
* unprefixed.
*
- * - On Android and Gonk, all functions are left unprefixed. Additionally,
- * C++ allocation functions (operator new/delete) are also exported and
- * unprefixed.
- *
* - On other systems (mostly Linux), all functions are left unprefixed.
*
- * Only Android and Gonk add C++ allocation functions.
*
* Proper exporting of the various functions is done with the MOZ_MEMORY_API
* and MOZ_JEMALLOC_API macros. MOZ_MEMORY_API is meant to be used for malloc
@@ -72,14 +67,6 @@
* dedicated to jemalloc specific functions.
*
*
- * All these functions are meant to be called with no prefix from Gecko code.
- * In most cases, this is because that's how they are available at runtime.
- * However, on Android, this relies on faulty.lib (the custom dynamic linker)
- * resolving mozglue symbols before libc symbols, which is guaranteed by the
- * way faulty.lib works (it respects the DT_NEEDED order, and libc always
- * appears after mozglue ; which we double check when building anyways)
- *
- *
* Within libmozglue (when MOZ_MEMORY_IMPL is defined), all the functions
* should be suffixed with "_impl" both for declarations and use.
* That is, the implementation declaration for e.g. strdup would look like:
@@ -133,9 +120,6 @@
# endif
# else
# define MOZ_MEMORY_API MFBT_API
-# if defined(MOZ_WIDGET_ANDROID)
-# define MOZ_WRAP_NEW_DELETE
-# endif
# endif
# endif
# ifdef XP_WIN
@@ -184,15 +168,6 @@
# define wcsdup_impl mozmem_dup_impl(wcsdup)
#endif
-/* String functions */
-#ifdef ANDROID
-/* Bug 801571 and Bug 879668, libstagefright uses vasprintf, causing malloc()/
- * free() to be mismatched between bionic and mozglue implementation.
- */
-#define vasprintf_impl mozmem_dup_impl(vasprintf)
-#define asprintf_impl mozmem_dup_impl(asprintf)
-#endif
-
/* Jemalloc specific function */
#define jemalloc_stats_impl mozmem_jemalloc_impl(jemalloc_stats)
#define jemalloc_purge_freed_pages_impl mozmem_jemalloc_impl(jemalloc_purge_freed_pages)
diff --git a/memory/build/replace_malloc.c b/memory/build/replace_malloc.c
index f4c7eb878..91f86497c 100644
--- a/memory/build/replace_malloc.c
+++ b/memory/build/replace_malloc.c
@@ -24,14 +24,11 @@
* LD_PRELOAD or DYLD_INSERT_LIBRARIES on Linux/OSX. On this platform,
* the replacement functions are defined as variable pointers to the
* function resolved with GetProcAddress() instead of weak definitions
- * of functions. On Android, the same needs to happen as well, because
- * the Android linker doesn't handle weak linking with non LD_PRELOADed
- * libraries, but LD_PRELOADing is not very convenient on Android, with
- * the zygote.
+ * of functions.
*/
#ifdef XP_DARWIN
# define MOZ_REPLACE_WEAK __attribute__((weak_import))
-#elif defined(XP_WIN) || defined(MOZ_WIDGET_ANDROID)
+#elif defined(XP_WIN)
# define MOZ_NO_REPLACE_FUNC_DECL
#elif defined(__GNUC__)
# define MOZ_REPLACE_WEAK __attribute__((weak))
@@ -71,24 +68,6 @@ replace_malloc_init_funcs()
}
}
}
-# elif defined(MOZ_WIDGET_ANDROID)
-# include <dlfcn.h>
-# include <stdlib.h>
-static void
-replace_malloc_init_funcs()
-{
- const char *replace_malloc_lib = getenv("MOZ_REPLACE_MALLOC_LIB");
- if (replace_malloc_lib && *replace_malloc_lib) {
- void *handle = dlopen(replace_malloc_lib, RTLD_LAZY);
- if (handle) {
-#define MALLOC_DECL(name, ...) \
- replace_ ## name = (replace_ ## name ## _impl_t *) dlsym(handle, "replace_" # name);
-
-# define MALLOC_FUNCS MALLOC_FUNCS_ALL
-#include "malloc_decls.h"
- }
- }
-}
# else
# error No implementation for replace_malloc_init_funcs()
# endif
diff --git a/memory/build/replace_malloc.h b/memory/build/replace_malloc.h
index a61744f60..3e592749a 100644
--- a/memory/build/replace_malloc.h
+++ b/memory/build/replace_malloc.h
@@ -13,7 +13,7 @@
* environment variables to the library path:
* - LD_PRELOAD on Linux,
* - DYLD_INSERT_LIBRARIES on OSX,
- * - MOZ_REPLACE_MALLOC_LIB on Windows and Android.
+ * - MOZ_REPLACE_MALLOC_LIB on Windows.
*
* An initialization function is called before any malloc replacement
* function, and has the following declaration:
diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h
index 18752a798..f42c7b04a 100644
--- a/memory/mozalloc/mozalloc.h
+++ b/memory/mozalloc/mozalloc.h
@@ -160,16 +160,7 @@ MFBT_API void* moz_xvalloc(size_t size)
# define MOZALLOC_EXPORT_NEW
#endif
-#if defined(ANDROID)
-/*
- * It's important to always specify 'throw()' in GCC because it's used to tell
- * GCC that 'new' may return null. That makes GCC null-check the result before
- * potentially initializing the memory to zero.
- * Also, the Android minimalistic headers don't include std::bad_alloc.
- */
-#define MOZALLOC_THROW_IF_HAS_EXCEPTIONS throw()
-#define MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS
-#elif defined(_MSC_VER)
+#if defined(_MSC_VER)
/*
* Suppress build warning spam (bug 578546).
*/
diff --git a/memory/mozalloc/mozalloc_abort.cpp b/memory/mozalloc/mozalloc_abort.cpp
index 85e566db0..40fce125c 100644
--- a/memory/mozalloc/mozalloc_abort.cpp
+++ b/memory/mozalloc/mozalloc_abort.cpp
@@ -7,9 +7,6 @@
#include "mozilla/mozalloc_abort.h"
-#ifdef ANDROID
-# include <android/log.h>
-#endif
#ifdef MOZ_WIDGET_ANDROID
# include "APKOpen.h"
# include "dlfcn.h"
@@ -21,40 +18,11 @@
void
mozalloc_abort(const char* const msg)
{
-#ifndef ANDROID
fputs(msg, stderr);
fputs("\n", stderr);
-#else
- __android_log_print(ANDROID_LOG_ERROR, "Gecko", "mozalloc_abort: %s", msg);
-#endif
-#ifdef MOZ_WIDGET_ANDROID
- abortThroughJava(msg);
-#endif
MOZ_CRASH();
}
-#ifdef MOZ_WIDGET_ANDROID
-template <size_t N>
-void fillAbortMessage(char (&msg)[N], uintptr_t retAddress) {
- /*
- * On Android, we often don't have reliable backtrace when crashing inside
- * abort(). Therefore, we try to find out who is calling abort() and add
- * that to the message.
- */
- Dl_info info = {};
- dladdr(reinterpret_cast<void*>(retAddress), &info);
-
- const char* const module = info.dli_fname ? info.dli_fname : "";
- const char* const base_module = strrchr(module, '/');
- const void* const module_offset =
- reinterpret_cast<void*>(retAddress - uintptr_t(info.dli_fbase));
- const char* const sym = info.dli_sname ? info.dli_sname : "";
-
- snprintf(msg, sizeof(msg), "abort() called from %s:%p (%s)",
- base_module ? base_module + 1 : module, module_offset, sym);
-}
-#endif
-
#if defined(XP_UNIX) && !defined(MOZ_ASAN)
// Define abort() here, so that it is used instead of the system abort(). This
// lets us control the behavior when aborting, in order to get better results
@@ -70,12 +38,7 @@ void fillAbortMessage(char (&msg)[N], uintptr_t retAddress) {
// result, ASan will just exit(1) instead of aborting.
extern "C" void abort(void)
{
-#ifdef MOZ_WIDGET_ANDROID
- char msg[64] = {};
- fillAbortMessage(msg, uintptr_t(__builtin_return_address(0)));
-#else
const char* const msg = "Redirecting call to abort() to mozalloc_abort\n";
-#endif
mozalloc_abort(msg);
diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c
index ecc9d2985..50ba22889 100644
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -100,11 +100,6 @@
*******************************************************************************
*/
-#ifdef MOZ_MEMORY_ANDROID
-#define NO_TLS
-#define _pthread_self() pthread_self()
-#endif
-
/*
* On Linux, we use madvise(MADV_DONTNEED) to release memory back to the
* operating system. If we release 1MB of live pages with MADV_DONTNEED, our
@@ -174,7 +169,7 @@
# define MALLOC_SYSV
#endif
-#if defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
+#ifdef MOZ_MEMORY_LINUX
#define _GNU_SOURCE /* For mremap(2). */
#endif
@@ -498,7 +493,7 @@ static bool malloc_initialized = false;
/* No init lock for Windows. */
#elif defined(MOZ_MEMORY_DARWIN)
static malloc_mutex_t init_lock = {OS_SPINLOCK_INIT};
-#elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
+#elif defined(MOZ_MEMORY_LINUX)
static malloc_mutex_t init_lock = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP;
#else
static malloc_mutex_t init_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -1374,12 +1369,6 @@ void (*_malloc_message)(const char *p1, const char *p2, const char *p3,
# define assert(e)
#endif
-#ifdef MOZ_MEMORY_ANDROID
-// Android's pthread.h does not declare pthread_atfork() until SDK 21.
-extern MOZ_EXPORT
-int pthread_atfork(void (*)(void), void (*)(void), void(*)(void));
-#endif
-
#if defined(MOZ_JEMALLOC_HARD_ASSERTS)
# define RELEASE_ASSERT(assertion) do { \
if (!(assertion)) { \
@@ -1404,7 +1393,7 @@ malloc_mutex_init(malloc_mutex_t *mutex)
InitializeSRWLock(mutex);
#elif defined(MOZ_MEMORY_DARWIN)
mutex->lock = OS_SPINLOCK_INIT;
-#elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
+#elif defined(MOZ_MEMORY_LINUX)
pthread_mutexattr_t attr;
if (pthread_mutexattr_init(&attr) != 0)
return (true);
@@ -1457,7 +1446,7 @@ malloc_spin_init(malloc_spinlock_t *lock)
InitializeSRWLock(lock);
#elif defined(MOZ_MEMORY_DARWIN)
lock->lock = OS_SPINLOCK_INIT;
-#elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
+#elif defined(MOZ_MEMORY_LINUX)
pthread_mutexattr_t attr;
if (pthread_mutexattr_init(&attr) != 0)
return (true);
diff --git a/memory/replace/logalloc/LogAlloc.cpp b/memory/replace/logalloc/LogAlloc.cpp
index f9b375048..6491dba99 100644
--- a/memory/replace/logalloc/LogAlloc.cpp
+++ b/memory/replace/logalloc/LogAlloc.cpp
@@ -54,16 +54,6 @@ GetTid()
#endif
}
-#ifdef ANDROID
-/* See mozglue/android/APKOpen.cpp */
-extern "C" MOZ_EXPORT __attribute__((weak))
-void* __dso_handle;
-
-/* Android doesn't have pthread_atfork defined in pthread.h */
-extern "C" MOZ_EXPORT
-int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
-#endif
-
class LogAllocBridge : public ReplaceMallocBridge
{
virtual void InitDebugFd(mozilla::DebugFdRegistry& aRegistry) override {
diff --git a/memory/replace/logalloc/moz.build b/memory/replace/logalloc/moz.build
index e549dca76..7a60a8afa 100644
--- a/memory/replace/logalloc/moz.build
+++ b/memory/replace/logalloc/moz.build
@@ -20,22 +20,10 @@ DEFINES['DEBUG'] = False
# Use locking code from the chromium stack.
if CONFIG['OS_TARGET'] == 'WINNT':
- SOURCES += [
- '../../../ipc/chromium/src/base/lock_impl_win.cc',
- ]
+ SOURCES += ['../../../ipc/chromium/src/base/lock_impl_win.cc']
else:
- SOURCES += [
- '../../../ipc/chromium/src/base/lock_impl_posix.cc',
- ]
+ SOURCES += ['../../../ipc/chromium/src/base/lock_impl_posix.cc']
include('/ipc/chromium/chromium-config.mozbuild')
-# Android doesn't have pthread_atfork, but we have our own in mozglue.
-if CONFIG['OS_TARGET'] == 'Android':
- USE_LIBS += [
- 'mozglue',
- ]
-
-DIRS += [
- 'replay',
-]
+DIRS += ['replay']
diff --git a/memory/replace/logalloc/replay/Replay.cpp b/memory/replace/logalloc/replay/Replay.cpp
index 0ae20de2c..de352189c 100644
--- a/memory/replace/logalloc/replay/Replay.cpp
+++ b/memory/replace/logalloc/replay/Replay.cpp
@@ -290,23 +290,6 @@ MOZ_BEGIN_EXTERN_C
void malloc_init_hard(void);
#endif
-#ifdef ANDROID
-/* mozjemalloc uses MozTagAnonymousMemory, which doesn't have an inline
- * implementation on Android */
-void
-MozTagAnonymousMemory(const void* aPtr, size_t aLength, const char* aTag) {}
-
-/* mozjemalloc and jemalloc use pthread_atfork, which Android doesn't have.
- * While gecko has one in libmozglue, the replay program can't use that.
- * Since we're not going to fork anyways, make it a dummy function. */
-int
-pthread_atfork(void (*aPrepare)(void), void (*aParent)(void),
- void (*aChild)(void))
-{
- return 0;
-}
-#endif
-
MOZ_END_EXTERN_C
size_t parseNumber(Buffer aBuf)
diff --git a/memory/volatile/VolatileBuffer.h b/memory/volatile/VolatileBuffer.h
index ebb471332..b6bcdfcb7 100644
--- a/memory/volatile/VolatileBuffer.h
+++ b/memory/volatile/VolatileBuffer.h
@@ -76,9 +76,7 @@ private:
void* mBuf;
size_t mSize;
int mLockCount;
-#if defined(ANDROID)
- int mFd;
-#elif defined(XP_DARWIN)
+#ifdef XP_DARWIN
bool mHeap;
#elif defined(XP_WIN)
bool mHeap;
diff --git a/memory/volatile/VolatileBufferAshmem.cpp b/memory/volatile/VolatileBufferAshmem.cpp
deleted file mode 100644
index 09904d6ef..000000000
--- a/memory/volatile/VolatileBufferAshmem.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "VolatileBuffer.h"
-#include "mozilla/Assertions.h"
-#include "mozilla/mozalloc.h"
-
-#include <fcntl.h>
-#include <linux/ashmem.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#ifdef MOZ_MEMORY
-extern "C" int posix_memalign(void** memptr, size_t alignment, size_t size);
-#endif
-
-#define MIN_VOLATILE_ALLOC_SIZE 8192
-
-namespace mozilla {
-
-VolatileBuffer::VolatileBuffer()
- : mMutex("VolatileBuffer")
- , mBuf(nullptr)
- , mSize(0)
- , mLockCount(0)
- , mFd(-1)
-{
-}
-
-bool
-VolatileBuffer::Init(size_t aSize, size_t aAlignment)
-{
- MOZ_ASSERT(!mSize && !mBuf, "Init called twice");
- MOZ_ASSERT(!(aAlignment % sizeof(void *)),
- "Alignment must be multiple of pointer size");
-
- mSize = aSize;
- if (aSize < MIN_VOLATILE_ALLOC_SIZE) {
- goto heap_alloc;
- }
-
- mFd = open("/" ASHMEM_NAME_DEF, O_RDWR);
- if (mFd < 0) {
- goto heap_alloc;
- }
-
- if (ioctl(mFd, ASHMEM_SET_SIZE, mSize) < 0) {
- goto heap_alloc;
- }
-
- mBuf = mmap(nullptr, mSize, PROT_READ | PROT_WRITE, MAP_SHARED, mFd, 0);
- if (mBuf != MAP_FAILED) {
- return true;
- }
-
-heap_alloc:
- mBuf = nullptr;
- if (mFd >= 0) {
- close(mFd);
- mFd = -1;
- }
-
-#ifdef MOZ_MEMORY
- posix_memalign(&mBuf, aAlignment, aSize);
-#else
- mBuf = memalign(aAlignment, aSize);
-#endif
- return !!mBuf;
-}
-
-VolatileBuffer::~VolatileBuffer()
-{
- MOZ_ASSERT(mLockCount == 0, "Being destroyed with non-zero lock count?");
-
- if (OnHeap()) {
- free(mBuf);
- } else {
- munmap(mBuf, mSize);
- close(mFd);
- }
-}
-
-bool
-VolatileBuffer::Lock(void** aBuf)
-{
- MutexAutoLock lock(mMutex);
-
- MOZ_ASSERT(mBuf, "Attempting to lock an uninitialized VolatileBuffer");
-
- *aBuf = mBuf;
- if (++mLockCount > 1 || OnHeap()) {
- return true;
- }
-
- // Zero offset and zero length means we want to pin/unpin the entire thing.
- struct ashmem_pin pin = { 0, 0 };
- return ioctl(mFd, ASHMEM_PIN, &pin) == ASHMEM_NOT_PURGED;
-}
-
-void
-VolatileBuffer::Unlock()
-{
- MutexAutoLock lock(mMutex);
-
- MOZ_ASSERT(mLockCount > 0, "VolatileBuffer unlocked too many times!");
- if (--mLockCount || OnHeap()) {
- return;
- }
-
- struct ashmem_pin pin = { 0, 0 };
- ioctl(mFd, ASHMEM_UNPIN, &pin);
-}
-
-bool
-VolatileBuffer::OnHeap() const
-{
- return mFd < 0;
-}
-
-size_t
-VolatileBuffer::HeapSizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
-{
- return OnHeap() ? aMallocSizeOf(mBuf) : 0;
-}
-
-size_t
-VolatileBuffer::NonHeapSizeOfExcludingThis() const
-{
- if (OnHeap()) {
- return 0;
- }
-
- return (mSize + (PAGE_SIZE - 1)) & PAGE_MASK;
-}
-
-} // namespace mozilla
diff --git a/memory/volatile/moz.build b/memory/volatile/moz.build
index deacdf433..5132237a2 100644
--- a/memory/volatile/moz.build
+++ b/memory/volatile/moz.build
@@ -5,26 +5,14 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
NO_VISIBILITY_FLAGS = True
-EXPORTS.mozilla += [
- 'VolatileBuffer.h',
-]
+EXPORTS.mozilla += ['VolatileBuffer.h']
-if CONFIG['OS_TARGET'] == 'Android':
- UNIFIED_SOURCES += [
- 'VolatileBufferAshmem.cpp',
- ]
-elif CONFIG['OS_TARGET'] == 'Darwin':
- UNIFIED_SOURCES += [
- 'VolatileBufferOSX.cpp',
- ]
+if CONFIG['OS_TARGET'] == 'Darwin':
+ UNIFIED_SOURCES += ['VolatileBufferOSX.cpp']
elif CONFIG['OS_TARGET'] == 'WINNT':
- UNIFIED_SOURCES += [
- 'VolatileBufferWindows.cpp',
- ]
+ UNIFIED_SOURCES += ['VolatileBufferWindows.cpp']
else:
- UNIFIED_SOURCES += [
- 'VolatileBufferFallback.cpp',
- ]
+ UNIFIED_SOURCES += ['VolatileBufferFallback.cpp']
FINAL_LIBRARY = 'xul'
diff --git a/memory/volatile/tests/TestVolatileBuffer.cpp b/memory/volatile/tests/TestVolatileBuffer.cpp
index dff8e794a..7d21236a4 100644
--- a/memory/volatile/tests/TestVolatileBuffer.cpp
+++ b/memory/volatile/tests/TestVolatileBuffer.cpp
@@ -6,13 +6,7 @@
#include "mozilla/VolatileBuffer.h"
#include <string.h>
-#if defined(ANDROID)
-#include <fcntl.h>
-#include <linux/ashmem.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#elif defined(XP_DARWIN)
+#ifdef XP_DARWIN
#include <mach/mach.h>
#endif