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

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: 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
Index: base/shared_memory_posix.cc
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index 1261d508d4275b7dbf099c8e0d951a87dfb37c97..26e654761959c4a1fae248d3f687fd51ac59b2cf 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::kMapMinimumAlignment - 1));
+ } else {
memory_ = NULL;
+ }
return mmap_succeeded;
}

Powered by Google App Engine
This is Rietveld 408576698