Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Side by Side Diff: base/android/jni_generator/testNativeExportsOnlyOption.golden

Issue 2219923002: JNI: allow either JavaRef or bare objects in Java calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unreachable line Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/example/jni_generator/SampleForTests 8 // org/chromium/example/jni_generator/SampleForTests
9 9
10 #ifndef org_chromium_example_jni_generator_SampleForTests_JNI 10 #ifndef org_chromium_example_jni_generator_SampleForTests_JNI
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 jcaller); 67 jcaller);
68 68
69 extern "C" __attribute__((visibility("default"))) 69 extern "C" __attribute__((visibility("default")))
70 jint 70 jint
71 Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerCla ss_nativeInit(JNIEnv* 71 Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerCla ss_nativeInit(JNIEnv*
72 env, jobject jcaller) { 72 env, jobject jcaller) {
73 return Init(env, base::android::JavaParamRef<jobject>(env, jcaller)); 73 return Init(env, base::android::JavaParamRef<jobject>(env, jcaller));
74 } 74 }
75 75
76 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParam = 0; 76 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParam = 0;
77 static void Java_SampleForTests_testMethodWithParam(JNIEnv* env, jobject obj, 77 static void Java_SampleForTests_testMethodWithParam(JNIEnv* env, const
78 JniIntWrapper iParam) { 78 base::android::JavaRefOrBare<jobject>& obj, JniIntWrapper iParam) {
79 CHECK_CLAZZ(env, obj, 79 CHECK_CLAZZ(env, obj.obj(),
80 SampleForTests_clazz(env)); 80 SampleForTests_clazz(env));
81 jmethodID method_id = 81 jmethodID method_id =
82 base::android::MethodID::LazyGet< 82 base::android::MethodID::LazyGet<
83 base::android::MethodID::TYPE_INSTANCE>( 83 base::android::MethodID::TYPE_INSTANCE>(
84 env, SampleForTests_clazz(env), 84 env, SampleForTests_clazz(env),
85 "testMethodWithParam", 85 "testMethodWithParam",
86 86
87 "(" 87 "("
88 "I" 88 "I"
89 ")" 89 ")"
90 "V", 90 "V",
91 &g_SampleForTests_testMethodWithParam); 91 &g_SampleForTests_testMethodWithParam);
92 92
93 env->CallVoidMethod(obj, 93 env->CallVoidMethod(obj.obj(),
94 method_id, as_jint(iParam)); 94 method_id, as_jint(iParam));
95 jni_generator::CheckException(env); 95 jni_generator::CheckException(env);
96 96
97 } 97 }
98 98
99 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParamAndReturn = 99 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParamAndReturn =
100 0; 100 0;
101 static base::android::ScopedJavaLocalRef<jstring> 101 static base::android::ScopedJavaLocalRef<jstring>
102 Java_SampleForTests_testMethodWithParamAndReturn(JNIEnv* env, jobject obj, 102 Java_SampleForTests_testMethodWithParamAndReturn(JNIEnv* env, const
103 JniIntWrapper iParam) { 103 base::android::JavaRefOrBare<jobject>& obj, JniIntWrapper iParam) {
104 CHECK_CLAZZ(env, obj, 104 CHECK_CLAZZ(env, obj.obj(),
105 SampleForTests_clazz(env), NULL); 105 SampleForTests_clazz(env), NULL);
106 jmethodID method_id = 106 jmethodID method_id =
107 base::android::MethodID::LazyGet< 107 base::android::MethodID::LazyGet<
108 base::android::MethodID::TYPE_INSTANCE>( 108 base::android::MethodID::TYPE_INSTANCE>(
109 env, SampleForTests_clazz(env), 109 env, SampleForTests_clazz(env),
110 "testMethodWithParamAndReturn", 110 "testMethodWithParamAndReturn",
111 111
112 "(" 112 "("
113 "I" 113 "I"
114 ")" 114 ")"
115 "Ljava/lang/String;", 115 "Ljava/lang/String;",
116 &g_SampleForTests_testMethodWithParamAndReturn); 116 &g_SampleForTests_testMethodWithParamAndReturn);
117 117
118 jstring ret = 118 jstring ret =
119 static_cast<jstring>(env->CallObjectMethod(obj, 119 static_cast<jstring>(env->CallObjectMethod(obj.obj(),
120 method_id, as_jint(iParam))); 120 method_id, as_jint(iParam)));
121 jni_generator::CheckException(env); 121 jni_generator::CheckException(env);
122 return base::android::ScopedJavaLocalRef<jstring>(env, ret); 122 return base::android::ScopedJavaLocalRef<jstring>(env, ret);
123 } 123 }
124 124
125 static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithParam = 0; 125 static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithParam = 0;
126 static jint Java_SampleForTests_testStaticMethodWithParam(JNIEnv* env, 126 static jint Java_SampleForTests_testStaticMethodWithParam(JNIEnv* env,
127 JniIntWrapper iParam) { 127 JniIntWrapper iParam) {
128 CHECK_CLAZZ(env, SampleForTests_clazz(env), 128 CHECK_CLAZZ(env, SampleForTests_clazz(env),
129 SampleForTests_clazz(env), 0); 129 SampleForTests_clazz(env), 0);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 jstring ret = 188 jstring ret =
189 static_cast<jstring>(env->CallStaticObjectMethod(SampleForTests_clazz(env), 189 static_cast<jstring>(env->CallStaticObjectMethod(SampleForTests_clazz(env),
190 method_id)); 190 method_id));
191 jni_generator::CheckException(env); 191 jni_generator::CheckException(env);
192 return base::android::ScopedJavaLocalRef<jstring>(env, ret); 192 return base::android::ScopedJavaLocalRef<jstring>(env, ret);
193 } 193 }
194 194
195 // Step 3: RegisterNatives. 195 // Step 3: RegisterNatives.
196 196
197 #endif // org_chromium_example_jni_generator_SampleForTests_JNI 197 #endif // org_chromium_example_jni_generator_SampleForTests_JNI
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698