| OLD | NEW |
| 1 // Copyright (c) 2012 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 // This file is autogenerated by | 5 // This file is autogenerated by |
| 6 // base/android/jni_generator/jni_generator.py | 6 // base/android/jni_generator/jni_generator.py |
| 7 // For | 7 // For |
| 8 // org/chromium/TestJni | 8 // org/chromium/TestJni |
| 9 | 9 |
| 10 #ifndef org_chromium_TestJni_JNI | 10 #ifndef org_chromium_TestJni_JNI |
| 11 #define org_chromium_TestJni_JNI | 11 #define org_chromium_TestJni_JNI |
| 12 | 12 |
| 13 #include <jni.h> | 13 #include <jni.h> |
| 14 | 14 |
| 15 #include "base/android/jni_generator/jni_generator_helper.h" | 15 #include "base/android/jni_generator/jni_generator_helper.h" |
| 16 | 16 |
| 17 #include "base/android/jni_int_wrapper.h" | 17 #include "base/android/jni_int_wrapper.h" |
| 18 | 18 |
| 19 // Step 1: forward declarations. | 19 // Step 1: forward declarations. |
| 20 namespace { | 20 namespace { |
| 21 const char kMyOtherInnerClassClassPath[] = | 21 const char kMyOtherInnerClassClassPath[] = |
| 22 "org/chromium/TestJni$MyOtherInnerClass"; | 22 "org/chromium/TestJni$MyOtherInnerClass"; |
| 23 const char kTestJniClassPath[] = "org/chromium/TestJni"; | 23 const char kTestJniClassPath[] = "org/chromium/TestJni"; |
| 24 const char kMyInnerClassClassPath[] = "org/chromium/TestJni$MyInnerClass"; | 24 const char kMyInnerClassClassPath[] = "org/chromium/TestJni$MyInnerClass"; |
| 25 #if __clang__ |
| 26 #pragma clang diagnostic push |
| 27 #pragma clang diagnostic ignored "-Wunused-function" |
| 28 #endif |
| 25 // Leaking this jclass as we cannot use LazyInstance from some threads. | 29 // Leaking this jclass as we cannot use LazyInstance from some threads. |
| 26 jclass g_TestJni_clazz = NULL; | 30 jclass g_TestJni_clazz = NULL; |
| 31 jclass TestJni_clazz(JNIEnv*) { return g_TestJni_clazz; } |
| 32 #if __clang__ |
| 33 #pragma clang diagnostic pop |
| 34 #endif |
| 27 | 35 |
| 28 } // namespace | 36 } // namespace |
| 29 | 37 |
| 30 static jint Init(JNIEnv* env, jobject jcaller); | 38 static jint Init(JNIEnv* env, jobject jcaller); |
| 31 | 39 |
| 32 static jint Init(JNIEnv* env, jobject jcaller); | 40 static jint Init(JNIEnv* env, jobject jcaller); |
| 33 | 41 |
| 34 // Step 2: method stubs. | 42 // Step 2: method stubs. |
| 35 | 43 |
| 36 // Step 3: RegisterNatives. | 44 // Step 3: RegisterNatives. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 49 "I", reinterpret_cast<void*>(Init) }, | 57 "I", reinterpret_cast<void*>(Init) }, |
| 50 }; | 58 }; |
| 51 | 59 |
| 52 static bool RegisterNativesImpl(JNIEnv* env) { | 60 static bool RegisterNativesImpl(JNIEnv* env) { |
| 53 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 61 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
| 54 base::android::GetClass(env, kTestJniClassPath).obj())); | 62 base::android::GetClass(env, kTestJniClassPath).obj())); |
| 55 | 63 |
| 56 const int kMethodsMyOtherInnerClassSize = | 64 const int kMethodsMyOtherInnerClassSize = |
| 57 arraysize(kMethodsMyOtherInnerClass); | 65 arraysize(kMethodsMyOtherInnerClass); |
| 58 | 66 |
| 59 if (env->RegisterNatives(g_MyOtherInnerClass_clazz, | 67 if (env->RegisterNatives(MyOtherInnerClass_clazz(env), |
| 60 kMethodsMyOtherInnerClass, | 68 kMethodsMyOtherInnerClass, |
| 61 kMethodsMyOtherInnerClassSize) < 0) { | 69 kMethodsMyOtherInnerClassSize) < 0) { |
| 62 jni_generator::HandleRegistrationError( | 70 jni_generator::HandleRegistrationError( |
| 63 env, g_MyOtherInnerClass_clazz, __FILE__); | 71 env, MyOtherInnerClass_clazz(env), __FILE__); |
| 64 return false; | 72 return false; |
| 65 } | 73 } |
| 66 | 74 |
| 67 const int kMethodsMyInnerClassSize = arraysize(kMethodsMyInnerClass); | 75 const int kMethodsMyInnerClassSize = arraysize(kMethodsMyInnerClass); |
| 68 | 76 |
| 69 if (env->RegisterNatives(g_MyInnerClass_clazz, | 77 if (env->RegisterNatives(MyInnerClass_clazz(env), |
| 70 kMethodsMyInnerClass, | 78 kMethodsMyInnerClass, |
| 71 kMethodsMyInnerClassSize) < 0) { | 79 kMethodsMyInnerClassSize) < 0) { |
| 72 jni_generator::HandleRegistrationError( | 80 jni_generator::HandleRegistrationError( |
| 73 env, g_MyInnerClass_clazz, __FILE__); | 81 env, MyInnerClass_clazz(env), __FILE__); |
| 74 return false; | 82 return false; |
| 75 } | 83 } |
| 76 | 84 |
| 77 return true; | 85 return true; |
| 78 } | 86 } |
| 79 | 87 |
| 80 #endif // org_chromium_TestJni_JNI | 88 #endif // org_chromium_TestJni_JNI |
| OLD | NEW |