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

Unified Diff: mojo/android/system/core_impl.cc

Issue 405893004: Java core implementation: ensure correct alignment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECKs Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/android/system/core_impl.cc
diff --git a/mojo/android/system/core_impl.cc b/mojo/android/system/core_impl.cc
index 36b28dce830b80852743bc1225bca0035bf640e2..704e8c7f62865f7279b0687a86c9bda26e2a8581 100644
--- a/mojo/android/system/core_impl.cc
+++ b/mojo/android/system/core_impl.cc
@@ -64,6 +64,7 @@ static jint WaitMany(JNIEnv* env,
// Buffer contains first the list of handles, then the list of signals.
const void* buffer_start = env->GetDirectBufferAddress(buffer);
DCHECK(buffer_start);
+ DCHECK_EQ(reinterpret_cast<const uintptr_t>(buffer_start) % 8, 0u);
const size_t record_size = 8;
const size_t buffer_size = env->GetDirectBufferCapacity(buffer);
DCHECK_EQ(buffer_size % record_size, 0u);
@@ -82,6 +83,7 @@ static jobject CreateMessagePipe(JNIEnv* env,
if (options_buffer) {
const void* buffer_start = env->GetDirectBufferAddress(options_buffer);
DCHECK(buffer_start);
+ DCHECK_EQ(reinterpret_cast<const uintptr_t>(buffer_start) % 8, 0u);
const size_t buffer_size = env->GetDirectBufferCapacity(options_buffer);
DCHECK_EQ(buffer_size, sizeof(MojoCreateMessagePipeOptions));
options = static_cast<const MojoCreateMessagePipeOptions*>(buffer_start);
@@ -101,6 +103,7 @@ static jobject CreateDataPipe(JNIEnv* env,
if (options_buffer) {
const void* buffer_start = env->GetDirectBufferAddress(options_buffer);
DCHECK(buffer_start);
+ DCHECK_EQ(reinterpret_cast<const uintptr_t>(buffer_start) % 8, 0u);
const size_t buffer_size = env->GetDirectBufferCapacity(options_buffer);
DCHECK_EQ(buffer_size, sizeof(MojoCreateDataPipeOptions));
options = static_cast<const MojoCreateDataPipeOptions*>(buffer_start);
@@ -121,6 +124,7 @@ static jobject CreateSharedBuffer(JNIEnv* env,
if (options_buffer) {
const void* buffer_start = env->GetDirectBufferAddress(options_buffer);
DCHECK(buffer_start);
+ DCHECK_EQ(reinterpret_cast<const uintptr_t>(buffer_start) % 8, 0u);
const size_t buffer_size = env->GetDirectBufferCapacity(options_buffer);
DCHECK_EQ(buffer_size, sizeof(MojoCreateSharedBufferOptions));
options = static_cast<const MojoCreateSharedBufferOptions*>(buffer_start);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698