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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/android/system/core_impl.h" 5 #include "mojo/android/system/core_impl.h"
6 6
7 #include "base/android/base_jni_registrar.h" 7 #include "base/android/base_jni_registrar.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_registrar.h" 9 #include "base/android/jni_registrar.h"
10 #include "base/android/library_loader/library_loader_hooks.h" 10 #include "base/android/library_loader/library_loader_hooks.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // If |id| is |kInvalidHandleCancelID|, the async wait was done on an 381 // If |id| is |kInvalidHandleCancelID|, the async wait was done on an
382 // invalid handle, so the AsyncWaitCallback will be called and will clear 382 // invalid handle, so the AsyncWaitCallback will be called and will clear
383 // the data_ptr. 383 // the data_ptr.
384 return; 384 return;
385 } 385 }
386 scoped_ptr<AsyncWaitCallbackData> deleter( 386 scoped_ptr<AsyncWaitCallbackData> deleter(
387 reinterpret_cast<AsyncWaitCallbackData*>(data_ptr)); 387 reinterpret_cast<AsyncWaitCallbackData*>(data_ptr));
388 Environment::GetDefaultAsyncWaiter()->CancelWait(id); 388 Environment::GetDefaultAsyncWaiter()->CancelWait(id);
389 } 389 }
390 390
391 static jint GetNativeBufferOffset(JNIEnv* env,
392 jobject jcaller,
393 jobject buffer,
394 jint alignment) {
395 jint offset =
396 reinterpret_cast<uintptr_t>(env->GetDirectBufferAddress(buffer)) %
397 alignment;
398 if (offset == 0)
399 return 0;
400 return alignment - offset;
401 }
402
391 bool RegisterCoreImpl(JNIEnv* env) { 403 bool RegisterCoreImpl(JNIEnv* env) {
392 return RegisterNativesImpl(env); 404 return RegisterNativesImpl(env);
393 } 405 }
394 406
395 } // namespace android 407 } // namespace android
396 } // namespace mojo 408 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698