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