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// This file is autogenerated by
6//     base/android/jni_generator/jni_generator.py
7// For
8//     org/chromium/TestJni
9
10#ifndef org_chromium_TestJni_JNI
11#define org_chromium_TestJni_JNI
12
13#include <jni.h>
14
15#include "base/android/jni_generator/jni_generator_helper.h"
16
17#include "base/android/jni_int_wrapper.h"
18
19// Step 1: forward declarations.
20namespace {
21const char kMyOtherInnerClassClassPath[] =
22    "org/chromium/TestJni$MyOtherInnerClass";
23const char kTestJniClassPath[] = "org/chromium/TestJni";
24const char kMyInnerClassClassPath[] = "org/chromium/TestJni$MyInnerClass";
25// Leaking this jclass as we cannot use LazyInstance from some threads.
26base::subtle::AtomicWord g_MyOtherInnerClass_clazz __attribute__((unused)) = 0;
27#define MyOtherInnerClass_clazz(env) base::android::LazyGetClass(env, kMyOtherInnerClassClassPath, &g_MyOtherInnerClass_clazz)
28// Leaking this jclass as we cannot use LazyInstance from some threads.
29base::subtle::AtomicWord g_TestJni_clazz __attribute__((unused)) = 0;
30#define TestJni_clazz(env) base::android::LazyGetClass(env, kTestJniClassPath, &g_TestJni_clazz)
31// Leaking this jclass as we cannot use LazyInstance from some threads.
32base::subtle::AtomicWord g_MyInnerClass_clazz __attribute__((unused)) = 0;
33#define MyInnerClass_clazz(env) base::android::LazyGetClass(env, kMyInnerClassClassPath, &g_MyInnerClass_clazz)
34
35}  // namespace
36
37// Step 2: method stubs.
38
39static jint Init(JNIEnv* env, const base::android::JavaParamRef<jobject>&
40    jcaller);
41
42JNI_GENERATOR_EXPORT jint
43    Java_org_chromium_TestJni_00024MyInnerClass_nativeInit(JNIEnv* env, jobject
44    jcaller) {
45  return Init(env, base::android::JavaParamRef<jobject>(env, jcaller));
46}
47
48static jint Init(JNIEnv* env, const base::android::JavaParamRef<jobject>&
49    jcaller);
50
51JNI_GENERATOR_EXPORT jint
52    Java_org_chromium_TestJni_00024MyOtherInnerClass_nativeInit(JNIEnv* env,
53    jobject jcaller) {
54  return Init(env, base::android::JavaParamRef<jobject>(env, jcaller));
55}
56
57// Step 3: RegisterNatives.
58
59static const JNINativeMethod kMethodsMyOtherInnerClass[] = {
60    { "nativeInit",
61"("
62")"
63"I",
64    reinterpret_cast<void*>(Java_org_chromium_TestJni_00024MyOtherInnerClass_nativeInit)
65    },
66};
67
68static const JNINativeMethod kMethodsMyInnerClass[] = {
69    { "nativeInit",
70"("
71")"
72"I",
73    reinterpret_cast<void*>(Java_org_chromium_TestJni_00024MyInnerClass_nativeInit)
74    },
75};
76
77static bool RegisterNativesImpl(JNIEnv* env) {
78  if (jni_generator::ShouldSkipJniRegistration(false))
79    return true;
80
81  const int kMethodsMyOtherInnerClassSize =
82      arraysize(kMethodsMyOtherInnerClass);
83
84  if (env->RegisterNatives(MyOtherInnerClass_clazz(env),
85                           kMethodsMyOtherInnerClass,
86                           kMethodsMyOtherInnerClassSize) < 0) {
87    jni_generator::HandleRegistrationError(
88        env, MyOtherInnerClass_clazz(env), __FILE__);
89    return false;
90  }
91
92  const int kMethodsMyInnerClassSize = arraysize(kMethodsMyInnerClass);
93
94  if (env->RegisterNatives(MyInnerClass_clazz(env),
95                           kMethodsMyInnerClass,
96                           kMethodsMyInnerClassSize) < 0) {
97    jni_generator::HandleRegistrationError(
98        env, MyInnerClass_clazz(env), __FILE__);
99    return false;
100  }
101
102  return true;
103}
104
105#endif  // org_chromium_TestJni_JNI
106