Commit 2094202b authored by scottmg's avatar scottmg Committed by Commit Bot

Fuchsia: implement OS::Allocate

Fix v8 link errors (in component_build=true)
https://build.chromium.org/p/chromium.fyi/builders/Fuchsia%20(dbg)

BUG=chromium:731217

Review-Url: https://codereview.chromium.org/2930343002
Cr-Commit-Position: refs/heads/master@{#45878}
parent dbe87c66
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include <sys/mman.h>
#include "src/base/macros.h" #include "src/base/macros.h"
#include "src/base/platform/platform-posix.h" #include "src/base/platform/platform-posix.h"
#include "src/base/platform/platform.h" #include "src/base/platform/platform.h"
...@@ -11,6 +13,17 @@ namespace base { ...@@ -11,6 +13,17 @@ namespace base {
TimezoneCache* OS::CreateTimezoneCache() { return new PosixTimezoneCache(); } 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() { std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217.
return std::vector<SharedLibraryAddress>(); return std::vector<SharedLibraryAddress>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment