diff options
author | qsr@chromium.org <qsr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-22 12:43:04 +0000 |
---|---|---|
committer | qsr@chromium.org <qsr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-22 12:43:04 +0000 |
commit | d6b872af349e04e7706083788d3a9f3ffc497463 (patch) | |
tree | d7fc431c00934d2feacd6a6dac327b87ba4a173e | |
parent | ea84e6074b78937feb0193edf4aa6d6c8663dd67 (diff) | |
download | chromium_src-d6b872af349e04e7706083788d3a9f3ffc497463.zip chromium_src-d6b872af349e04e7706083788d3a9f3ffc497463.tar.gz chromium_src-d6b872af349e04e7706083788d3a9f3ffc497463.tar.bz2 |
Java core implementation: ensure correct alignment.
Ensures that buffer received from the java side are correctly aligned.
R=viettrungluu@chromium.org
Review URL: https://codereview.chromium.org/405893004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284672 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | mojo/android/system/core_impl.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mojo/android/system/core_impl.cc b/mojo/android/system/core_impl.cc index 36b28dc..704e8c7 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); |