Index: src/base/platform/platform-fuchsia.cc |
diff --git a/src/base/platform/platform-fuchsia.cc b/src/base/platform/platform-fuchsia.cc |
index 149ca037e47dedb69c9fe1a987a3600486a43c3d..dc39297a6d9dcc8584edda575cce25165f02cfed 100644 |
--- a/src/base/platform/platform-fuchsia.cc |
+++ b/src/base/platform/platform-fuchsia.cc |
@@ -2,6 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include <sys/mman.h> |
+ |
#include "src/base/macros.h" |
#include "src/base/platform/platform-posix.h" |
#include "src/base/platform/platform.h" |
@@ -11,6 +13,17 @@ namespace base { |
TimezoneCache* OS::CreateTimezoneCache() { return new PosixTimezoneCache(); } |
+void* OS::Allocate(const size_t requested, size_t* allocated, |
+ OS::MemoryPermission access) { |
+ const size_t msize = RoundUp(requested, AllocateAlignment()); |
+ int prot = GetProtectionFromMemoryPermission(access); |
+ void* addr = OS::GetRandomMmapAddr(); |
+ void* mbase = mmap(addr, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
+ if (mbase == MAP_FAILED) return NULL; |
+ *allocated = msize; |
+ return mbase; |
+} |
+ |
std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { |
CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. |
return std::vector<SharedLibraryAddress>(); |