1diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc 2index e1289e7e1da0..aa718957cf26 100644 3--- a/base/memory/shared_memory_posix.cc 4+++ b/base/memory/shared_memory_posix.cc 5@@ -29,6 +30,8 @@ 6 7 #if defined(OS_ANDROID) 8 #include "base/os_compat_android.h" 9+#endif 10+#if defined(OS_ANDROID) || defined(__ANDROID__) 11 #include "third_party/ashmem/ashmem.h" 12 #endif 13 14@@ -80,7 +83,7 @@ bool SharedMemory::CreateAndMapAnonymous(size_t size) { 15 return CreateAnonymous(size) && Map(size); 16 } 17 18-#if !defined(OS_ANDROID) 19+#if !defined(OS_ANDROID) && !defined(__ANDROID__) 20 21 // Chromium mostly only uses the unique/private shmem as specified by 22 // "name == L"". The exception is in the StatsTable. 23@@ -252,7 +255,7 @@ bool SharedMemory::Open(const std::string& name, bool read_only) { 24 FileDescriptor(readonly_mapped_file, false), 0, shm_.GetGUID()); 25 return result; 26 } 27-#endif // !defined(OS_ANDROID) 28+#endif // !defined(OS_ANDROID) && !defined(__ANDROID__) 29 30 bool SharedMemory::MapAt(off_t offset, size_t bytes) { 31 if (!shm_.IsValid()) 32@@ -264,7 +267,7 @@ bool SharedMemory::MapAt(off_t offset, size_t bytes) { 33 if (memory_) 34 return false; 35 36-#if defined(OS_ANDROID) 37+#if defined(OS_ANDROID) || defined(__ANDROID__) 38 // On Android, Map can be called with a size and offset of zero to use the 39 // ashmem-determined size. 40 if (bytes == 0) { 41@@ -277,19 +280,19 @@ bool SharedMemory::MapAt(off_t offset, size_t bytes) { 42 43 // Sanity check. This shall catch invalid uses of the SharedMemory APIs 44 // but will not protect against direct mmap() attempts. 45- if (shm_.IsReadOnly()) { 46- // Use a DCHECK() to call writable mappings with read-only descriptors 47- // in debug builds immediately. Return an error for release builds 48- // or during unit-testing (assuming a ScopedLogAssertHandler was installed). 49- DCHECK(read_only_) 50- << "Trying to map a region writable with a read-only descriptor."; 51- if (!read_only_) { 52- return false; 53- } 54- if (!shm_.SetRegionReadOnly()) { // Ensure the region is read-only. 55- return false; 56- } 57- } 58+ // if (shm_.IsReadOnly()) { 59+ // // Use a DCHECK() to call writable mappings with read-only descriptors 60+ // // in debug builds immediately. Return an error for release builds 61+ // // or during unit-testing (assuming a ScopedLogAssertHandler was installed). 62+ // DCHECK(read_only_) 63+ // << "Trying to map a region writable with a read-only descriptor."; 64+ // if (!read_only_) { 65+ // return false; 66+ // } 67+ // if (!shm_.SetRegionReadOnly()) { // Ensure the region is read-only. 68+ // return false; 69+ // } 70+ // } 71 #endif 72 73 memory_ = mmap(nullptr, bytes, PROT_READ | (read_only_ ? 0 : PROT_WRITE), 74@@ -334,7 +339,7 @@ SharedMemoryHandle SharedMemory::TakeHandle() { 75 return handle_copy; 76 } 77 78-#if !defined(OS_ANDROID) 79+#if !defined(OS_ANDROID) && !defined(__ANDROID__) 80 void SharedMemory::Close() { 81 if (shm_.IsValid()) { 82 shm_.Close(); 83@@ -374,6 +379,6 @@ SharedMemoryHandle SharedMemory::GetReadOnlyHandle() const { 84 CHECK(readonly_shm_.IsValid()); 85 return readonly_shm_.Duplicate(); 86 } 87-#endif // !defined(OS_ANDROID) 88+#endif // !defined(OS_ANDROID) && !defined(__ANDROID__) 89 90 } // namespace base 91