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

Side by Side Diff: base/android/jni_generator/jni_generator_helper.h

Issue 2565723002: android: Realign stack pointer on JNI entry. (Closed)
Patch Set: Created 4 years 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
6 #ifndef BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ 5 #ifndef BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_
7 #define BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ 6 #define BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_
8 7
9 #include <jni.h> 8 #include <jni.h>
10 9
11 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
12 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "build/build_config.h"
14 14
15 // Project-specific macros used by the header files generated by 15 // Project-specific macros used by the header files generated by
16 // jni_generator.py. Different projects can then specify their own 16 // jni_generator.py. Different projects can then specify their own
17 // implementation for this file. 17 // implementation for this file.
18 #define CHECK_NATIVE_PTR(env, jcaller, native_ptr, method_name, ...) \ 18 #define CHECK_NATIVE_PTR(env, jcaller, native_ptr, method_name, ...) \
19 DCHECK(native_ptr) << method_name; 19 DCHECK(native_ptr) << method_name;
20 20
21 #define CHECK_CLAZZ(env, jcaller, clazz, ...) \ 21 #define CHECK_CLAZZ(env, jcaller, clazz, ...) DCHECK(clazz);
22 DCHECK(clazz); 22
23 #if defined(ARCH_CPU_X86)
24 // Dalvik JIT generated code doesn't guarantee 16-byte stack alignment on
25 // x86 - use force_align_arg_pointer to realign the stack at the JNI
26 // boundary. crbug.com/655248
27 #define JNI_GENERATOR_EXPORT \
28 extern "C" __attribute__((visibility("default"), force_align_arg_pointer))
29 #else
30 #define JNI_GENERATOR_EXPORT extern "C" __attribute__((visibility("default")))
31 #endif
23 32
24 namespace jni_generator { 33 namespace jni_generator {
25 34
26 inline void HandleRegistrationError(JNIEnv* env, jclass clazz, 35 inline void HandleRegistrationError(JNIEnv* env,
27 const char* filename) { 36 jclass clazz,
28 LOG(ERROR) << "RegisterNatives failed in " << filename; 37 const char* filename) {
29 } 38 LOG(ERROR) << "RegisterNatives failed in " << filename;
39 }
30 40
31 inline void CheckException(JNIEnv* env) { 41 inline void CheckException(JNIEnv* env) {
32 base::android::CheckException(env); 42 base::android::CheckException(env);
33 } 43 }
34 44
35 } // namespace jni_generator 45 } // namespace jni_generator
36 46
37 #endif // BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ 47 #endif // BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_
OLDNEW
« no previous file with comments | « base/android/jni_generator/jni_generator.py ('k') | base/android/jni_generator/jni_generator_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698