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

Unified Diff: base/shared_memory_posix.cc

Issue 10827400: Advertise a minimum alignment for SharedMemory::Map(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename enum. Created 8 years, 4 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 | « base/shared_memory_nacl.cc ('k') | base/shared_memory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/shared_memory_posix.cc
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index 1261d508d4275b7dbf099c8e0d951a87dfb37c97..d2bb219f6c2196a6ab3a1ba8af3b62758b1f42c4 100644
--- a/base/shared_memory_posix.cc
+++ b/base/shared_memory_posix.cc
@@ -240,10 +240,13 @@ bool SharedMemory::Map(uint32 bytes) {
MAP_SHARED, mapped_file_, 0);
bool mmap_succeeded = memory_ != (void*)-1 && memory_ != NULL;
- if (mmap_succeeded)
+ if (mmap_succeeded) {
mapped_size_ = bytes;
- else
+ DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(memory_) &
+ (SharedMemory::MAP_MINIMUM_ALIGNMENT - 1));
+ } else {
memory_ = NULL;
+ }
return mmap_succeeded;
}
« no previous file with comments | « base/shared_memory_nacl.cc ('k') | base/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698