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

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

Issue 1127313006: Fix alignment issue on old ART runtime. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 7 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/android/system/core_impl.cc
diff --git a/mojo/android/system/core_impl.cc b/mojo/android/system/core_impl.cc
index d42c292b9898b87eac3f98715a3e38b653297b7d..0a80e60b1a2909ab5dd757bae669759e34dedc5a 100644
--- a/mojo/android/system/core_impl.cc
+++ b/mojo/android/system/core_impl.cc
@@ -388,6 +388,18 @@ static void CancelAsyncWait(JNIEnv* env,
Environment::GetDefaultAsyncWaiter()->CancelWait(id);
}
+static jint GetNativeBufferOffset(JNIEnv* env,
+ jobject jcaller,
+ jobject buffer,
+ jint alignment) {
+ jint offset =
+ reinterpret_cast<uintptr_t>(env->GetDirectBufferAddress(buffer)) %
+ alignment;
+ if (offset == 0)
+ return 0;
+ return alignment - offset;
+}
+
bool RegisterCoreImpl(JNIEnv* env) {
return RegisterNativesImpl(env);
}

Powered by Google App Engine
This is Rietveld 408576698