OLD | NEW |
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 // 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/foo/Foo | 8 // org/chromium/foo/Foo |
9 | 9 |
10 #ifndef org_chromium_foo_Foo_JNI | 10 #ifndef org_chromium_foo_Foo_JNI |
11 #define org_chromium_foo_Foo_JNI | 11 #define org_chromium_foo_Foo_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 kFooClassPath[] = "org/chromium/foo/Foo"; | 21 const char kFooClassPath[] = "org/chromium/foo/Foo"; |
22 // Leaking this jclass as we cannot use LazyInstance from some threads. | 22 // Leaking this jclass as we cannot use LazyInstance from some threads. |
23 base::subtle::AtomicWord g_Foo_clazz __attribute__((unused)) = 0; | 23 base::subtle::AtomicWord g_Foo_clazz __attribute__((unused)) = 0; |
24 #define Foo_clazz(env) base::android::LazyGetClass(env, kFooClassPath, &g_Foo_cl
azz) | 24 #define Foo_clazz(env) base::android::LazyGetClass(env, kFooClassPath, &g_Foo_cl
azz) |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 // Step 2: method stubs. | 28 // Step 2: method stubs. |
29 | 29 |
30 static void DoSomething(JNIEnv* env, const JavaParamRef<jclass>& jcaller, | 30 static void DoSomething(JNIEnv* env, const base::android::JavaParamRef<jclass>& |
31 const JavaParamRef<jobject>& callback); | 31 jcaller, |
| 32 const base::android::JavaParamRef<jobject>& callback); |
32 | 33 |
33 extern "C" __attribute__((visibility("default"))) | 34 extern "C" __attribute__((visibility("default"))) |
34 void Java_org_chromium_foo_Foo_nativeDoSomething(JNIEnv* env, jclass jcaller, | 35 void Java_org_chromium_foo_Foo_nativeDoSomething(JNIEnv* env, jclass jcaller, |
35 jobject callback) { | 36 jobject callback) { |
36 return DoSomething(env, JavaParamRef<jclass>(env, jcaller), | 37 return DoSomething(env, base::android::JavaParamRef<jclass>(env, jcaller), |
37 JavaParamRef<jobject>(env, callback)); | 38 base::android::JavaParamRef<jobject>(env, callback)); |
38 } | 39 } |
39 | 40 |
40 static base::subtle::AtomicWord g_Foo_calledByNative = 0; | 41 static base::subtle::AtomicWord g_Foo_calledByNative = 0; |
41 static void Java_Foo_calledByNative(JNIEnv* env, jobject callback) { | 42 static void Java_Foo_calledByNative(JNIEnv* env, jobject callback) { |
42 CHECK_CLAZZ(env, Foo_clazz(env), | 43 CHECK_CLAZZ(env, Foo_clazz(env), |
43 Foo_clazz(env)); | 44 Foo_clazz(env)); |
44 jmethodID method_id = | 45 jmethodID method_id = |
45 base::android::MethodID::LazyGet< | 46 base::android::MethodID::LazyGet< |
46 base::android::MethodID::TYPE_STATIC>( | 47 base::android::MethodID::TYPE_STATIC>( |
47 env, Foo_clazz(env), | 48 env, Foo_clazz(env), |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 kMethodsFooSize) < 0) { | 80 kMethodsFooSize) < 0) { |
80 jni_generator::HandleRegistrationError( | 81 jni_generator::HandleRegistrationError( |
81 env, Foo_clazz(env), __FILE__); | 82 env, Foo_clazz(env), __FILE__); |
82 return false; | 83 return false; |
83 } | 84 } |
84 | 85 |
85 return true; | 86 return true; |
86 } | 87 } |
87 | 88 |
88 #endif // org_chromium_foo_Foo_JNI | 89 #endif // org_chromium_foo_Foo_JNI |
OLD | NEW |