• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3// found in the LICENSE file.
4
5
6// This file is autogenerated by
7//     base/android/jni_generator/jni_generator.py
8// For
9//     org/chromium/example/jni_generator/SampleForTests
10
11#ifndef org_chromium_example_jni_generator_SampleForTests_JNI
12#define org_chromium_example_jni_generator_SampleForTests_JNI
13
14#include <jni.h>
15
16#include "base/android/jni_generator/jni_generator_helper.h"
17
18
19// Step 1: Forward declarations.
20
21JNI_REGISTRATION_EXPORT extern const char
22    kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass[];
23const char kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass[] =
24    "org/chromium/example/jni_generator/SampleForTests$MyOtherInnerClass";
25
26JNI_REGISTRATION_EXPORT extern const char
27    kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass[];
28const char kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass[] =
29    "org/chromium/example/jni_generator/SampleForTests$MyInnerClass";
30
31JNI_REGISTRATION_EXPORT extern const char
32    kClassPath_org_chromium_example_jni_1generator_SampleForTests[];
33const char kClassPath_org_chromium_example_jni_1generator_SampleForTests[] =
34    "org/chromium/example/jni_generator/SampleForTests";
35// Leaking this jclass as we cannot use LazyInstance from some threads.
36JNI_REGISTRATION_EXPORT base::subtle::AtomicWord
37    g_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_clazz = 0;
38#ifndef org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_clazz_defined
39#define org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_clazz_defined
40inline jclass
41    org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_clazz(JNIEnv* env) {
42  return base::android::LazyGetClass(env,
43      kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass,
44      &g_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_clazz);
45}
46#endif
47// Leaking this jclass as we cannot use LazyInstance from some threads.
48JNI_REGISTRATION_EXPORT base::subtle::AtomicWord
49    g_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_clazz = 0;
50#ifndef org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_clazz_defined
51#define org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_clazz_defined
52inline jclass org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_clazz(JNIEnv*
53    env) {
54  return base::android::LazyGetClass(env,
55      kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass,
56      &g_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_clazz);
57}
58#endif
59// Leaking this jclass as we cannot use LazyInstance from some threads.
60JNI_REGISTRATION_EXPORT base::subtle::AtomicWord
61    g_org_chromium_example_jni_1generator_SampleForTests_clazz = 0;
62#ifndef org_chromium_example_jni_1generator_SampleForTests_clazz_defined
63#define org_chromium_example_jni_1generator_SampleForTests_clazz_defined
64inline jclass org_chromium_example_jni_1generator_SampleForTests_clazz(JNIEnv* env) {
65  return base::android::LazyGetClass(env,
66      kClassPath_org_chromium_example_jni_1generator_SampleForTests,
67      &g_org_chromium_example_jni_1generator_SampleForTests_clazz);
68}
69#endif
70
71
72// Step 2: Constants (optional).
73
74
75// Step 3: Method stubs.
76JNI_GENERATOR_EXPORT jint
77    Java_org_chromium_example_jni_1generator_SampleForTests_nativeStaticMethod(
78    JNIEnv* env,
79    jobject jcaller,
80    jlong nativeTest,
81    jint arg1) {
82  Test* native = reinterpret_cast<Test*>(nativeTest);
83  CHECK_NATIVE_PTR(env, jcaller, native, "StaticMethod", 0);
84  return native->StaticMethod(env, base::android::JavaParamRef<jobject>(env, jcaller), arg1);
85}
86
87JNI_GENERATOR_EXPORT jint Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(
88    JNIEnv* env,
89    jobject jcaller,
90    jlong nativeTest,
91    jint arg1) {
92  Test* native = reinterpret_cast<Test*>(nativeTest);
93  CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0);
94  return native->Method(env, base::android::JavaParamRef<jobject>(env, jcaller), arg1);
95}
96
97static jint JNI_MyInnerClass_Init(JNIEnv* env, const base::android::JavaParamRef<jobject>& jcaller);
98
99JNI_GENERATOR_EXPORT jint
100    Java_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_nativeInit(
101    JNIEnv* env,
102    jobject jcaller) {
103  return JNI_MyInnerClass_Init(env, base::android::JavaParamRef<jobject>(env, jcaller));
104}
105
106static jint JNI_MyOtherInnerClass_Init(JNIEnv* env, const base::android::JavaParamRef<jobject>&
107    jcaller);
108
109JNI_GENERATOR_EXPORT jint
110    Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_nativeInit(
111    JNIEnv* env,
112    jobject jcaller) {
113  return JNI_MyOtherInnerClass_Init(env, base::android::JavaParamRef<jobject>(env, jcaller));
114}
115
116
117static base::subtle::AtomicWord
118    g_org_chromium_example_jni_1generator_SampleForTests_testMethodWithParam = 0;
119static void Java_SampleForTests_testMethodWithParam(JNIEnv* env, const
120    base::android::JavaRef<jobject>& obj, JniIntWrapper iParam) {
121  CHECK_CLAZZ(env, obj.obj(),
122      org_chromium_example_jni_1generator_SampleForTests_clazz(env));
123  jmethodID method_id = base::android::MethodID::LazyGet<
124      base::android::MethodID::TYPE_INSTANCE>(
125          env, org_chromium_example_jni_1generator_SampleForTests_clazz(env),
126          "testMethodWithParam",
127          "(I)V",
128          &g_org_chromium_example_jni_1generator_SampleForTests_testMethodWithParam);
129
130     env->CallVoidMethod(obj.obj(),
131          method_id, as_jint(iParam));
132  jni_generator::CheckException(env);
133}
134
135static base::subtle::AtomicWord
136    g_org_chromium_example_jni_1generator_SampleForTests_testMethodWithParamAndReturn = 0;
137static base::android::ScopedJavaLocalRef<jstring>
138    Java_SampleForTests_testMethodWithParamAndReturn(JNIEnv* env, const
139    base::android::JavaRef<jobject>& obj, JniIntWrapper iParam) {
140  CHECK_CLAZZ(env, obj.obj(),
141      org_chromium_example_jni_1generator_SampleForTests_clazz(env), NULL);
142  jmethodID method_id = base::android::MethodID::LazyGet<
143      base::android::MethodID::TYPE_INSTANCE>(
144          env, org_chromium_example_jni_1generator_SampleForTests_clazz(env),
145          "testMethodWithParamAndReturn",
146          "(I)Ljava/lang/String;",
147          &g_org_chromium_example_jni_1generator_SampleForTests_testMethodWithParamAndReturn);
148
149  jstring ret =
150      static_cast<jstring>(env->CallObjectMethod(obj.obj(),
151          method_id, as_jint(iParam)));
152  jni_generator::CheckException(env);
153  return base::android::ScopedJavaLocalRef<jstring>(env, ret);
154}
155
156static base::subtle::AtomicWord
157    g_org_chromium_example_jni_1generator_SampleForTests_testStaticMethodWithParam = 0;
158static jint Java_SampleForTests_testStaticMethodWithParam(JNIEnv* env, JniIntWrapper iParam) {
159  CHECK_CLAZZ(env, org_chromium_example_jni_1generator_SampleForTests_clazz(env),
160      org_chromium_example_jni_1generator_SampleForTests_clazz(env), 0);
161  jmethodID method_id = base::android::MethodID::LazyGet<
162      base::android::MethodID::TYPE_STATIC>(
163          env, org_chromium_example_jni_1generator_SampleForTests_clazz(env),
164          "testStaticMethodWithParam",
165          "(I)I",
166          &g_org_chromium_example_jni_1generator_SampleForTests_testStaticMethodWithParam);
167
168  jint ret =
169      env->CallStaticIntMethod(org_chromium_example_jni_1generator_SampleForTests_clazz(env),
170          method_id, as_jint(iParam));
171  jni_generator::CheckException(env);
172  return ret;
173}
174
175static base::subtle::AtomicWord
176    g_org_chromium_example_jni_1generator_SampleForTests_testMethodWithNoParam = 0;
177static jdouble Java_SampleForTests_testMethodWithNoParam(JNIEnv* env) {
178  CHECK_CLAZZ(env, org_chromium_example_jni_1generator_SampleForTests_clazz(env),
179      org_chromium_example_jni_1generator_SampleForTests_clazz(env), 0);
180  jmethodID method_id = base::android::MethodID::LazyGet<
181      base::android::MethodID::TYPE_STATIC>(
182          env, org_chromium_example_jni_1generator_SampleForTests_clazz(env),
183          "testMethodWithNoParam",
184          "()D",
185          &g_org_chromium_example_jni_1generator_SampleForTests_testMethodWithNoParam);
186
187  jdouble ret =
188      env->CallStaticDoubleMethod(org_chromium_example_jni_1generator_SampleForTests_clazz(env),
189          method_id);
190  jni_generator::CheckException(env);
191  return ret;
192}
193
194static base::subtle::AtomicWord
195    g_org_chromium_example_jni_1generator_SampleForTests_testStaticMethodWithNoParam = 0;
196static base::android::ScopedJavaLocalRef<jstring>
197    Java_SampleForTests_testStaticMethodWithNoParam(JNIEnv* env) {
198  CHECK_CLAZZ(env, org_chromium_example_jni_1generator_SampleForTests_clazz(env),
199      org_chromium_example_jni_1generator_SampleForTests_clazz(env), NULL);
200  jmethodID method_id = base::android::MethodID::LazyGet<
201      base::android::MethodID::TYPE_STATIC>(
202          env, org_chromium_example_jni_1generator_SampleForTests_clazz(env),
203          "testStaticMethodWithNoParam",
204          "()Ljava/lang/String;",
205          &g_org_chromium_example_jni_1generator_SampleForTests_testStaticMethodWithNoParam);
206
207  jstring ret =
208static_cast<jstring>(env->CallStaticObjectMethod(org_chromium_example_jni_1generator_SampleForTests_clazz(env),
209          method_id));
210  jni_generator::CheckException(env);
211  return base::android::ScopedJavaLocalRef<jstring>(env, ret);
212}
213
214#endif  // org_chromium_example_jni_generator_SampleForTests_JNI
215