gecko-dev/mozglue/android/Ashmem.h
James Willcox 0ef38c0b9c Bug 1598068 - Add ashmem abstraction to mozglue and use it everywhere r=glandium,jld
Apps targeting SDK 29 are not allowed to open /dev/ashmem directly, and
instead must use NDK functions. Those functions are only available in
SDK 26 and higher, so we need this shim to use the functions if they
are available, else fallback to opening /dev/ashmem directly.

Differential Revision: https://phabricator.services.mozilla.com/D61012

--HG--
extra : moz-landing-system : lando
2020-03-06 19:04:49 +00:00

23 lines
645 B
C++

/* 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/. */
#ifndef Ashmem_h__
#define Ashmem_h__
#include <linux/ashmem.h>
namespace mozilla {
namespace android {
// Wrappers for the ASharedMemory function in the NDK
// https://developer.android.com/ndk/reference/group/memory
MFBT_API int ashmem_create(const char* name, size_t size);
MFBT_API size_t ashmem_getSize(int fd);
MFBT_API int ashmem_setProt(int fd, int prot);
} // namespace android
} // namespace mozilla
#endif // Ashmem_h__