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/example/jni_generator/Example | 8 // org/chromium/example/jni_generator/Example |
9 | 9 |
10 #ifndef org_chromium_example_jni_generator_Example_JNI | 10 #ifndef org_chromium_example_jni_generator_Example_JNI |
11 #define org_chromium_example_jni_generator_Example_JNI | 11 #define org_chromium_example_jni_generator_Example_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 kExampleClassPath[] = "com/test/jni_generator/Example"; | 21 const char kExampleClassPath[] = "com/test/jni_generator/Example"; |
| 22 #if __clang__ |
| 23 #pragma clang diagnostic push |
| 24 #pragma clang diagnostic ignored "-Wunused-function" |
| 25 #endif |
22 // Leaking this jclass as we cannot use LazyInstance from some threads. | 26 // Leaking this jclass as we cannot use LazyInstance from some threads. |
23 jclass g_Example_clazz = NULL; | 27 jclass g_Example_clazz = NULL; |
| 28 jclass Example_clazz(JNIEnv*) { return g_Example_clazz; } |
| 29 #if __clang__ |
| 30 #pragma clang diagnostic pop |
| 31 #endif |
24 | 32 |
25 } // namespace | 33 } // namespace |
26 | 34 |
27 static void Test(JNIEnv* env, jclass jcaller, | 35 static void Test(JNIEnv* env, jclass jcaller, |
28 jobject t); | 36 jobject t); |
29 | 37 |
30 static void Test2(JNIEnv* env, jclass jcaller, | 38 static void Test2(JNIEnv* env, jclass jcaller, |
31 jobject t); | 39 jobject t); |
32 | 40 |
33 static void Test3(JNIEnv* env, jclass jcaller, | 41 static void Test3(JNIEnv* env, jclass jcaller, |
(...skipping 28 matching lines...) Expand all Loading... |
62 ")" | 70 ")" |
63 "V", reinterpret_cast<void*>(Test4) }, | 71 "V", reinterpret_cast<void*>(Test4) }, |
64 }; | 72 }; |
65 | 73 |
66 static bool RegisterNativesImpl(JNIEnv* env) { | 74 static bool RegisterNativesImpl(JNIEnv* env) { |
67 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 75 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
68 base::android::GetClass(env, kExampleClassPath).obj())); | 76 base::android::GetClass(env, kExampleClassPath).obj())); |
69 | 77 |
70 const int kMethodsExampleSize = arraysize(kMethodsExample); | 78 const int kMethodsExampleSize = arraysize(kMethodsExample); |
71 | 79 |
72 if (env->RegisterNatives(g_Example_clazz, | 80 if (env->RegisterNatives(Example_clazz(env), |
73 kMethodsExample, | 81 kMethodsExample, |
74 kMethodsExampleSize) < 0) { | 82 kMethodsExampleSize) < 0) { |
75 jni_generator::HandleRegistrationError( | 83 jni_generator::HandleRegistrationError( |
76 env, g_Example_clazz, __FILE__); | 84 env, Example_clazz(env), __FILE__); |
77 return false; | 85 return false; |
78 } | 86 } |
79 | 87 |
80 return true; | 88 return true; |
81 } | 89 } |
82 | 90 |
83 #endif // org_chromium_example_jni_generator_Example_JNI | 91 #endif // org_chromium_example_jni_generator_Example_JNI |
OLD | NEW |