Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1474)

Unified Diff: mojo/edk/embedder/platform_shared_buffer.cc

Issue 2039713004: [mojo-edk] Make the Mojo EDK compile under NaCl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/embedder/platform_channel_utils_posix.cc ('k') | mojo/edk/system/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/embedder/platform_shared_buffer.cc
diff --git a/mojo/edk/embedder/platform_shared_buffer.cc b/mojo/edk/embedder/platform_shared_buffer.cc
index 467e5e6a8a184204473264bb60690ce42f63b856..53d8edc0f6238d3b4f13cfbd6d67183276ad3025 100644
--- a/mojo/edk/embedder/platform_shared_buffer.cc
+++ b/mojo/edk/embedder/platform_shared_buffer.cc
@@ -15,6 +15,11 @@
#include "base/sys_info.h"
#include "mojo/edk/embedder/platform_handle_utils.h"
+#if defined(OS_NACL)
+// For getpagesize() on NaCl.
+#include <unistd.h>
+#endif
+
namespace mojo {
namespace edk {
@@ -288,7 +293,13 @@ bool PlatformSharedBufferMapping::Map() {
// Mojo shared buffers can be mapped at any offset. However,
// base::SharedMemory must be mapped at a page boundary. So calculate what the
// nearest whole page offset is, and build a mapping that's offset from that.
- size_t offset_rounding = offset_ % base::SysInfo::VMAllocationGranularity();
+#if defined(OS_NACL)
+ // base::SysInfo isn't available under NaCl.
+ size_t page_size = getpagesize();
+#else
+ size_t page_size = base::SysInfo::VMAllocationGranularity();
+#endif
+ size_t offset_rounding = offset_ % page_size;
size_t real_offset = offset_ - offset_rounding;
size_t real_length = length_ + offset_rounding;
« no previous file with comments | « mojo/edk/embedder/platform_channel_utils_posix.cc ('k') | mojo/edk/system/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698