// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This file is autogenerated by // base/android/jni_generator/jni_generator.py // For // org/chromium/example/jni_generator/SampleForTests #ifndef org_chromium_example_jni_generator_SampleForTests_JNI #define org_chromium_example_jni_generator_SampleForTests_JNI #include #include "base/android/jni_generator/jni_generator_helper.h" // Step 1: forward declarations. JNI_REGISTRATION_EXPORT extern const char kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA[]; const char kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA[] = "org/chromium/example/jni_generator/SampleForTests$InnerStructA"; JNI_REGISTRATION_EXPORT extern const char kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024InnerClass[]; const char kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024InnerClass[] = "org/chromium/example/jni_generator/SampleForTests$InnerClass"; JNI_REGISTRATION_EXPORT extern const char kClassPath_org_chromium_example_jni_1generator_SampleForTests[]; const char kClassPath_org_chromium_example_jni_1generator_SampleForTests[] = "org/chromium/example/jni_generator/SampleForTests"; JNI_REGISTRATION_EXPORT extern const char kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB[]; const char kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB[] = "org/chromium/example/jni_generator/SampleForTests$InnerStructB"; // Leaking this jclass as we cannot use LazyInstance from some threads. JNI_REGISTRATION_EXPORT base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_clazz = 0; #ifndef org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_clazz_defined #define org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_clazz_defined inline jclass org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_clazz(JNIEnv* env) { return base::android::LazyGetClass(env, kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA, &g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_clazz); } #endif // Leaking this jclass as we cannot use LazyInstance from some threads. JNI_REGISTRATION_EXPORT base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_00024InnerClass_clazz = 0; #ifndef org_chromium_example_jni_1generator_SampleForTests_00024InnerClass_clazz_defined #define org_chromium_example_jni_1generator_SampleForTests_00024InnerClass_clazz_defined inline jclass org_chromium_example_jni_1generator_SampleForTests_00024InnerClass_clazz(JNIEnv* env) { return base::android::LazyGetClass(env, kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024InnerClass, &g_org_chromium_example_jni_1generator_SampleForTests_00024InnerClass_clazz); } #endif // Leaking this jclass as we cannot use LazyInstance from some threads. JNI_REGISTRATION_EXPORT base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_clazz = 0; #ifndef org_chromium_example_jni_1generator_SampleForTests_clazz_defined #define org_chromium_example_jni_1generator_SampleForTests_clazz_defined inline jclass org_chromium_example_jni_1generator_SampleForTests_clazz(JNIEnv* env) { return base::android::LazyGetClass(env, kClassPath_org_chromium_example_jni_1generator_SampleForTests, &g_org_chromium_example_jni_1generator_SampleForTests_clazz); } #endif // Leaking this jclass as we cannot use LazyInstance from some threads. JNI_REGISTRATION_EXPORT base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_clazz = 0; #ifndef org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_clazz_defined #define org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_clazz_defined inline jclass org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_clazz(JNIEnv* env) { return base::android::LazyGetClass(env, kClassPath_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB, &g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_clazz); } #endif namespace base { namespace android { // Step 2: method stubs. static jlong Init(JNIEnv* env, const base::android::JavaParamRef& jcaller, const base::android::JavaParamRef& param); JNI_GENERATOR_EXPORT jlong Java_org_chromium_example_jni_1generator_SampleForTests_nativeInit(JNIEnv* env, jobject jcaller, jstring param) { return Init(env, base::android::JavaParamRef(env, jcaller), base::android::JavaParamRef(env, param)); } JNI_GENERATOR_EXPORT void Java_org_chromium_example_jni_1generator_SampleForTests_nativeDestroy(JNIEnv* env, jobject jcaller, jlong nativeCPPClass) { CPPClass* native = reinterpret_cast(nativeCPPClass); CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); return native->Destroy(env, base::android::JavaParamRef(env, jcaller)); } static jdouble GetDoubleFunction(JNIEnv* env, const base::android::JavaParamRef& jcaller); JNI_GENERATOR_EXPORT jdouble Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetDoubleFunction(JNIEnv* env, jobject jcaller) { return GetDoubleFunction(env, base::android::JavaParamRef(env, jcaller)); } static jfloat GetFloatFunction(JNIEnv* env, const base::android::JavaParamRef& jcaller); JNI_GENERATOR_EXPORT jfloat Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetFloatFunction(JNIEnv* env, jclass jcaller) { return GetFloatFunction(env, base::android::JavaParamRef(env, jcaller)); } static void SetNonPODDatatype(JNIEnv* env, const base::android::JavaParamRef& jcaller, const base::android::JavaParamRef& rect); JNI_GENERATOR_EXPORT void Java_org_chromium_example_jni_1generator_SampleForTests_nativeSetNonPODDatatype(JNIEnv* env, jobject jcaller, jobject rect) { return SetNonPODDatatype(env, base::android::JavaParamRef(env, jcaller), base::android::JavaParamRef(env, rect)); } static base::android::ScopedJavaLocalRef GetNonPODDatatype(JNIEnv* env, const base::android::JavaParamRef& jcaller); JNI_GENERATOR_EXPORT jobject Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatatype(JNIEnv* env, jobject jcaller) { return GetNonPODDatatype(env, base::android::JavaParamRef(env, jcaller)).Release(); } JNI_GENERATOR_EXPORT jint Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv* env, jobject jcaller, jlong nativeCPPClass) { CPPClass* native = reinterpret_cast(nativeCPPClass); CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0); return native->Method(env, base::android::JavaParamRef(env, jcaller)); } JNI_GENERATOR_EXPORT jdouble Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethodOtherP0(JNIEnv* env, jobject jcaller, jlong nativePtr) { CPPClass::InnerClass* native = reinterpret_cast(nativePtr); CHECK_NATIVE_PTR(env, jcaller, native, "MethodOtherP0", 0); return native->MethodOtherP0(env, base::android::JavaParamRef(env, jcaller)); } JNI_GENERATOR_EXPORT void Java_org_chromium_example_jni_1generator_SampleForTests_nativeAddStructB(JNIEnv* env, jobject jcaller, jlong nativeCPPClass, jobject b) { CPPClass* native = reinterpret_cast(nativeCPPClass); CHECK_NATIVE_PTR(env, jcaller, native, "AddStructB"); return native->AddStructB(env, base::android::JavaParamRef(env, jcaller), base::android::JavaParamRef(env, b)); } JNI_GENERATOR_EXPORT void Java_org_chromium_example_jni_1generator_SampleForTests_nativeIterateAndDoSomethingWithStructB(JNIEnv* env, jobject jcaller, jlong nativeCPPClass) { CPPClass* native = reinterpret_cast(nativeCPPClass); CHECK_NATIVE_PTR(env, jcaller, native, "IterateAndDoSomethingWithStructB"); return native->IterateAndDoSomethingWithStructB(env, base::android::JavaParamRef(env, jcaller)); } JNI_GENERATOR_EXPORT jstring Java_org_chromium_example_jni_1generator_SampleForTests_nativeReturnAString(JNIEnv* env, jobject jcaller, jlong nativeCPPClass) { CPPClass* native = reinterpret_cast(nativeCPPClass); CHECK_NATIVE_PTR(env, jcaller, native, "ReturnAString", NULL); return native->ReturnAString(env, base::android::JavaParamRef(env, jcaller)).Release(); } static jint GetInnerIntFunction(JNIEnv* env, const base::android::JavaParamRef& jcaller); JNI_GENERATOR_EXPORT jint Java_org_chromium_example_jni_1generator_SampleForTests_00024InnerClass_nativeGetInnerIntFunction(JNIEnv* env, jclass jcaller) { return GetInnerIntFunction(env, base::android::JavaParamRef(env, jcaller)); } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_javaMethod = 0; static jint Java_SampleForTests_javaMethod(JNIEnv* env, const base::android::JavaRef& obj, JniIntWrapper foo, JniIntWrapper bar) { CHECK_CLAZZ(env, obj.obj(), org_chromium_example_jni_1generator_SampleForTests_clazz(env), 0); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, org_chromium_example_jni_1generator_SampleForTests_clazz(env), "javaMethod", "(" "I" "I" ")" "I", &g_org_chromium_example_jni_1generator_SampleForTests_javaMethod); jint ret = env->CallIntMethod(obj.obj(), method_id, as_jint(foo), as_jint(bar)); jni_generator::CheckException(env); return ret; } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_staticJavaMethod = 0; static jboolean Java_SampleForTests_staticJavaMethod(JNIEnv* env) { CHECK_CLAZZ(env, org_chromium_example_jni_1generator_SampleForTests_clazz(env), org_chromium_example_jni_1generator_SampleForTests_clazz(env), false); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_STATIC>( env, org_chromium_example_jni_1generator_SampleForTests_clazz(env), "staticJavaMethod", "(" ")" "Z", &g_org_chromium_example_jni_1generator_SampleForTests_staticJavaMethod); jboolean ret = env->CallStaticBooleanMethod(org_chromium_example_jni_1generator_SampleForTests_clazz(env), method_id); jni_generator::CheckException(env); return ret; } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_packagePrivateJavaMethod = 0; static void Java_SampleForTests_packagePrivateJavaMethod(JNIEnv* env, const base::android::JavaRef& obj) { CHECK_CLAZZ(env, obj.obj(), org_chromium_example_jni_1generator_SampleForTests_clazz(env)); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, org_chromium_example_jni_1generator_SampleForTests_clazz(env), "packagePrivateJavaMethod", "(" ")" "V", &g_org_chromium_example_jni_1generator_SampleForTests_packagePrivateJavaMethod); env->CallVoidMethod(obj.obj(), method_id); jni_generator::CheckException(env); } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_methodThatThrowsException = 0; static void Java_SampleForTests_methodThatThrowsException(JNIEnv* env, const base::android::JavaRef& obj) { CHECK_CLAZZ(env, obj.obj(), org_chromium_example_jni_1generator_SampleForTests_clazz(env)); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, org_chromium_example_jni_1generator_SampleForTests_clazz(env), "methodThatThrowsException", "(" ")" "V", &g_org_chromium_example_jni_1generator_SampleForTests_methodThatThrowsException); env->CallVoidMethod(obj.obj(), method_id); } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_javaMethodWithAnnotatedParam = 0; static void Java_SampleForTests_javaMethodWithAnnotatedParam(JNIEnv* env, const base::android::JavaRef& obj, JniIntWrapper foo) { CHECK_CLAZZ(env, obj.obj(), org_chromium_example_jni_1generator_SampleForTests_clazz(env)); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, org_chromium_example_jni_1generator_SampleForTests_clazz(env), "javaMethodWithAnnotatedParam", "(" "I" ")" "V", &g_org_chromium_example_jni_1generator_SampleForTests_javaMethodWithAnnotatedParam); env->CallVoidMethod(obj.obj(), method_id, as_jint(foo)); jni_generator::CheckException(env); } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_create = 0; static base::android::ScopedJavaLocalRef Java_InnerStructA_create(JNIEnv* env, jlong l, JniIntWrapper i, const base::android::JavaRef& s) { CHECK_CLAZZ(env, org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_clazz(env), org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_clazz(env), NULL); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_STATIC>( env, org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_clazz(env), "create", "(" "J" "I" "Ljava/lang/String;" ")" "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;", &g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_create); jobject ret = env->CallStaticObjectMethod(org_chromium_example_jni_1generator_SampleForTests_00024InnerStructA_clazz(env), method_id, l, as_jint(i), s.obj()); jni_generator::CheckException(env); return base::android::ScopedJavaLocalRef(env, ret); } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_addStructA = 0; static void Java_SampleForTests_addStructA(JNIEnv* env, const base::android::JavaRef& obj, const base::android::JavaRef& a) { CHECK_CLAZZ(env, obj.obj(), org_chromium_example_jni_1generator_SampleForTests_clazz(env)); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, org_chromium_example_jni_1generator_SampleForTests_clazz(env), "addStructA", "(" "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;" ")" "V", &g_org_chromium_example_jni_1generator_SampleForTests_addStructA); env->CallVoidMethod(obj.obj(), method_id, a.obj()); jni_generator::CheckException(env); } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_iterateAndDoSomething = 0; static void Java_SampleForTests_iterateAndDoSomething(JNIEnv* env, const base::android::JavaRef& obj) { CHECK_CLAZZ(env, obj.obj(), org_chromium_example_jni_1generator_SampleForTests_clazz(env)); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, org_chromium_example_jni_1generator_SampleForTests_clazz(env), "iterateAndDoSomething", "(" ")" "V", &g_org_chromium_example_jni_1generator_SampleForTests_iterateAndDoSomething); env->CallVoidMethod(obj.obj(), method_id); jni_generator::CheckException(env); } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_getKey = 0; static jlong Java_InnerStructB_getKey(JNIEnv* env, const base::android::JavaRef& obj) { CHECK_CLAZZ(env, obj.obj(), org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_clazz(env), 0); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_clazz(env), "getKey", "(" ")" "J", &g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_getKey); jlong ret = env->CallLongMethod(obj.obj(), method_id); jni_generator::CheckException(env); return ret; } static base::subtle::AtomicWord g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_getValue = 0; static base::android::ScopedJavaLocalRef Java_InnerStructB_getValue(JNIEnv* env, const base::android::JavaRef& obj) { CHECK_CLAZZ(env, obj.obj(), org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_clazz(env), NULL); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_INSTANCE>( env, org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_clazz(env), "getValue", "(" ")" "Ljava/lang/String;", &g_org_chromium_example_jni_1generator_SampleForTests_00024InnerStructB_getValue); jstring ret = static_cast(env->CallObjectMethod(obj.obj(), method_id)); jni_generator::CheckException(env); return base::android::ScopedJavaLocalRef(env, ret); } } // namespace android } // namespace base #endif // org_chromium_example_jni_generator_SampleForTests_JNI