// 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/foo/Foo #ifndef org_chromium_foo_Foo_JNI #define org_chromium_foo_Foo_JNI #include #include "base/android/jni_generator/jni_generator_helper.h" // Step 1: Forward declarations. JNI_REGISTRATION_EXPORT extern const char kClassPath_org_chromium_foo_Foo[]; const char kClassPath_org_chromium_foo_Foo[] = "org/chromium/foo/Foo"; // Leaking this jclass as we cannot use LazyInstance from some threads. JNI_REGISTRATION_EXPORT std::atomic g_org_chromium_foo_Foo_clazz(nullptr); #ifndef org_chromium_foo_Foo_clazz_defined #define org_chromium_foo_Foo_clazz_defined inline jclass org_chromium_foo_Foo_clazz(JNIEnv* env) { return base::android::LazyGetClass(env, kClassPath_org_chromium_foo_Foo, &g_org_chromium_foo_Foo_clazz); } #endif // Step 2: Constants (optional). // Step 3: Method stubs. static void JNI_Foo_DoSomething(JNIEnv* env, const base::android::JavaParamRef& jcaller, const base::android::JavaParamRef& callback1, const base::android::JavaParamRef& callback2); JNI_GENERATOR_EXPORT void Java_org_chromium_foo_Foo_nativeDoSomething( JNIEnv* env, jclass jcaller, jobject callback1, jobject callback2) { return JNI_Foo_DoSomething(env, base::android::JavaParamRef(env, jcaller), base::android::JavaParamRef(env, callback1), base::android::JavaParamRef(env, callback2)); } static std::atomic g_org_chromium_foo_Foo_calledByNative(nullptr); static void Java_Foo_calledByNative(JNIEnv* env, const base::android::JavaRef& callback1, const base::android::JavaRef& callback2) { CHECK_CLAZZ(env, org_chromium_foo_Foo_clazz(env), org_chromium_foo_Foo_clazz(env)); jmethodID method_id = base::android::MethodID::LazyGet< base::android::MethodID::TYPE_STATIC>( env, org_chromium_foo_Foo_clazz(env), "calledByNative", "(Lorg/chromium/foo/Bar1$Callback;Lorg/chromium/foo/Bar2$Callback;)V", &g_org_chromium_foo_Foo_calledByNative); env->CallStaticVoidMethod(org_chromium_foo_Foo_clazz(env), method_id, callback1.obj(), callback2.obj()); jni_generator::CheckException(env); } #endif // org_chromium_foo_Foo_JNI