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

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: Fix windows build. 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
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..fbdc0075950657e86b38b62f774f897037aa5ae2 100644
--- a/mojo/edk/embedder/platform_shared_buffer.cc
+++ b/mojo/edk/embedder/platform_shared_buffer.cc
@@ -5,6 +5,10 @@
#include "mojo/edk/embedder/platform_shared_buffer.h"
#include <stddef.h>
+#if defined(OS_NACL)
+// For getpagesize() on NaCl.
+#include <unistd.h>
+#endif
#include <utility>
@@ -288,7 +292,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;

Powered by Google App Engine
This is Rietveld 408576698