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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 static base::subtle::AtomicWord g_Foo_calledByNative = 0; | 41 static base::subtle::AtomicWord g_Foo_calledByNative = 0; |
42 static void Java_Foo_calledByNative(JNIEnv* env, const | 42 static void Java_Foo_calledByNative(JNIEnv* env, const |
43 base::android::JavaRefOrBare<jobject>& callback) { | 43 base::android::JavaRefOrBare<jobject>& callback) { |
44 CHECK_CLAZZ(env, Foo_clazz(env), | 44 CHECK_CLAZZ(env, Foo_clazz(env), |
45 Foo_clazz(env)); | 45 Foo_clazz(env)); |
46 jmethodID method_id = | 46 jmethodID method_id = |
47 base::android::MethodID::LazyGet< | 47 base::android::MethodID::LazyGet< |
48 base::android::MethodID::TYPE_STATIC>( | 48 base::android::MethodID::TYPE_STATIC>( |
49 env, Foo_clazz(env), | 49 env, Foo_clazz(env), |
50 "calledByNative", | 50 "calledByNative", |
51 | |
52 "(" | 51 "(" |
53 "Lorg/chromium/foo/Bar$Callback;" | 52 "Lorg/chromium/foo/Bar$Callback;" |
54 ")" | 53 ")" |
55 "V", | 54 "V", |
56 &g_Foo_calledByNative); | 55 &g_Foo_calledByNative); |
57 | 56 |
58 env->CallStaticVoidMethod(Foo_clazz(env), | 57 env->CallStaticVoidMethod(Foo_clazz(env), |
59 method_id, callback.obj()); | 58 method_id, callback.obj()); |
60 jni_generator::CheckException(env); | 59 jni_generator::CheckException(env); |
61 | |
62 } | 60 } |
63 | 61 |
64 // Step 3: RegisterNatives. | 62 // Step 3: RegisterNatives. |
65 | 63 |
66 static const JNINativeMethod kMethodsFoo[] = { | 64 static const JNINativeMethod kMethodsFoo[] = { |
67 { "nativeDoSomething", | 65 { "nativeDoSomething", |
68 "(" | 66 "(" |
69 "Lorg/chromium/foo/Bar$Callback;" | 67 "Lorg/chromium/foo/Bar$Callback;" |
70 ")" | 68 ")" |
71 "V", reinterpret_cast<void*>(Java_org_chromium_foo_Foo_nativeDoSomething) }, | 69 "V", reinterpret_cast<void*>(Java_org_chromium_foo_Foo_nativeDoSomething) }, |
72 }; | 70 }; |
73 | 71 |
74 static bool RegisterNativesImpl(JNIEnv* env) { | 72 static bool RegisterNativesImpl(JNIEnv* env) { |
75 if (base::android::IsManualJniRegistrationDisabled()) return true; | 73 if (base::android::IsManualJniRegistrationDisabled()) return true; |
76 | 74 |
77 const int kMethodsFooSize = arraysize(kMethodsFoo); | 75 const int kMethodsFooSize = arraysize(kMethodsFoo); |
78 | 76 |
79 if (env->RegisterNatives(Foo_clazz(env), | 77 if (env->RegisterNatives(Foo_clazz(env), |
80 kMethodsFoo, | 78 kMethodsFoo, |
81 kMethodsFooSize) < 0) { | 79 kMethodsFooSize) < 0) { |
82 jni_generator::HandleRegistrationError( | 80 jni_generator::HandleRegistrationError( |
83 env, Foo_clazz(env), __FILE__); | 81 env, Foo_clazz(env), __FILE__); |
84 return false; | 82 return false; |
85 } | 83 } |
86 | 84 |
87 return true; | 85 return true; |
88 } | 86 } |
89 | 87 |
90 #endif // org_chromium_foo_Foo_JNI | 88 #endif // org_chromium_foo_Foo_JNI |
OLD | NEW |