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 kTestJniClassPath[] = "org/chromium/TestJni"; 22const char kMyInnerClassClassPath[] = "org/chromium/TestJni$MyInnerClass"; 23// Leaking this jclass as we cannot use LazyInstance from some threads. 24base::subtle::AtomicWord g_TestJni_clazz __attribute__((unused)) = 0; 25#define TestJni_clazz(env) base::android::LazyGetClass(env, kTestJniClassPath, &g_TestJni_clazz) 26// Leaking this jclass as we cannot use LazyInstance from some threads. 27base::subtle::AtomicWord g_MyInnerClass_clazz __attribute__((unused)) = 0; 28#define MyInnerClass_clazz(env) base::android::LazyGetClass(env, kMyInnerClassClassPath, &g_MyInnerClass_clazz) 29 30} // namespace 31 32// Step 2: method stubs. 33 34static jint Init(JNIEnv* env, const base::android::JavaParamRef<jobject>& 35 jcaller); 36 37JNI_GENERATOR_EXPORT jint 38 Java_org_chromium_TestJni_00024MyInnerClass_nativeInit(JNIEnv* env, jobject 39 jcaller) { 40 return Init(env, base::android::JavaParamRef<jobject>(env, jcaller)); 41} 42 43// Step 3: RegisterNatives. 44 45static const JNINativeMethod kMethodsMyInnerClass[] = { 46 { "nativeInit", 47"(" 48")" 49"I", 50 reinterpret_cast<void*>(Java_org_chromium_TestJni_00024MyInnerClass_nativeInit) 51 }, 52}; 53 54static bool RegisterNativesImpl(JNIEnv* env) { 55 if (jni_generator::ShouldSkipJniRegistration(false)) 56 return true; 57 58 const int kMethodsMyInnerClassSize = arraysize(kMethodsMyInnerClass); 59 60 if (env->RegisterNatives(MyInnerClass_clazz(env), 61 kMethodsMyInnerClass, 62 kMethodsMyInnerClassSize) < 0) { 63 jni_generator::HandleRegistrationError( 64 env, MyInnerClass_clazz(env), __FILE__); 65 return false; 66 } 67 68 return true; 69} 70 71#endif // org_chromium_TestJni_JNI 72