• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 
6 #ifndef BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_
7 #define BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_
8 
9 #include <jni.h>
10 
11 #include "base/android/jni_android.h"
12 #include "base/android/scoped_java_ref.h"
13 #include "base/logging.h"
14 
15 // Project-specific macros used by the header files generated by
16 // jni_generator.py. Different projects can then specify their own
17 // implementation for this file.
18 #define CHECK_NATIVE_PTR(env, jcaller, native_ptr, method_name, ...) \
19     DCHECK(native_ptr) << method_name;
20 
21 #define CHECK_CLAZZ(env, jcaller, clazz, ...) \
22     DCHECK(clazz);
23 
24 namespace jni_generator {
25 
HandleRegistrationError(JNIEnv * env,jclass clazz,const char * filename)26   inline void HandleRegistrationError(JNIEnv* env, jclass clazz,
27                                       const char* filename) {
28     LOG(ERROR) << "RegisterNatives failed in " << filename;
29   }
30 
CheckException(JNIEnv * env)31   inline void CheckException(JNIEnv* env) {
32     base::android::CheckException(env);
33   }
34 
35 }  // namespace jni_generator
36 
37 using base::android::ScopedJavaLocalRef;
38 using base::android::JavaParamRef;
39 
40 #endif  // BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_
41