You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.4 KiB

// 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 <jni.h>
#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 base::subtle::AtomicWord g_org_chromium_foo_Foo_clazz = 0;
#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.
namespace org {
namespace chromium_foo {
JNI_GENERATOR_EXPORT void Java_org_chromium_foo_Foo_nativeInstanceMethod(
JNIEnv* env,
jobject jcaller,
jlong nativeInstance) {
TRACE_EVENT0("jni", "org::chromium_foo::Instance::InstanceMethod"); Instance* native =
reinterpret_cast<Instance*>(nativeInstance);
CHECK_NATIVE_PTR(env, jcaller, native, "InstanceMethod");
return native->InstanceMethod(env, base::android::JavaParamRef<jobject>(env, jcaller));
}
static void JNI_Foo_StaticMethod(JNIEnv* env, const base::android::JavaParamRef<jclass>& jcaller);
JNI_GENERATOR_EXPORT void Java_org_chromium_foo_Foo_nativeStaticMethod(
JNIEnv* env,
jclass jcaller) {
TRACE_EVENT0("jni", "org::chromium_foo::JNI_Foo_StaticMethod"); return JNI_Foo_StaticMethod(env,
base::android::JavaParamRef<jclass>(env, jcaller));
}
static base::subtle::AtomicWord g_org_chromium_foo_Foo_Constructor = 0;
static base::android::ScopedJavaLocalRef<jobject> Java_Foo_Constructor(JNIEnv* env) {
CHECK_CLAZZ(env, org_chromium_foo_Foo_clazz(env),
org_chromium_foo_Foo_clazz(env), NULL);
jmethodID method_id = base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, org_chromium_foo_Foo_clazz(env),
"<init>",
"()V",
&g_org_chromium_foo_Foo_Constructor);
TRACE_EVENT0("jni", "org.chromium.foo.Foo.<init>"); jobject ret =
env->NewObject(org_chromium_foo_Foo_clazz(env),
method_id);
jni_generator::CheckException(env);
return base::android::ScopedJavaLocalRef<jobject>(env, ret);
}
static base::subtle::AtomicWord g_org_chromium_foo_Foo_callbackFromNative = 0;
static void Java_Foo_callbackFromNative(JNIEnv* env, const base::android::JavaRef<jobject>& obj) {
CHECK_CLAZZ(env, obj.obj(),
org_chromium_foo_Foo_clazz(env));
jmethodID method_id = base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, org_chromium_foo_Foo_clazz(env),
"callbackFromNative",
"()V",
&g_org_chromium_foo_Foo_callbackFromNative);
TRACE_EVENT0("jni", "org.chromium.foo.Foo.callbackFromNative");
env->CallVoidMethod(obj.obj(),
method_id);
jni_generator::CheckException(env);
}
} // namespace chromium_foo
} // namespace org
#endif // org_chromium_foo_Foo_JNI