| Index: base/android/jni_generator/testEagerCalledByNativesOption.golden
|
| diff --git a/base/android/jni_generator/testEagerCalledByNativesOption.golden b/base/android/jni_generator/testEagerCalledByNativesOption.golden
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0f762c0d7f484c1b4f609089cffe5cbd0e809ea4
|
| --- /dev/null
|
| +++ b/base/android/jni_generator/testEagerCalledByNativesOption.golden
|
| @@ -0,0 +1,140 @@
|
| +// Copyright (c) 2012 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/Test
|
| +
|
| +#ifndef org_chromium_example_jni_generator_Test_JNI
|
| +#define org_chromium_example_jni_generator_Test_JNI
|
| +
|
| +#include <jni.h>
|
| +
|
| +#include "base/android/jni_generator/jni_generator_helper.h"
|
| +
|
| +// Step 1: forward declarations.
|
| +namespace {
|
| +const char kTestClassPath[] = "org/chromium/example/jni_generator/Test";
|
| +// Leaking this jclass as we cannot use LazyInstance from some threads.
|
| +jclass g_Test_clazz = NULL;
|
| +jmethodID g_Test_testMethodWithParam = NULL;
|
| +jmethodID g_Test_testStaticMethodWithParam = NULL;
|
| +jmethodID g_Test_testMethodWithNoParam = NULL;
|
| +jmethodID g_Test_testStaticMethodWithNoParam = NULL;
|
| +} // namespace
|
| +
|
| +// Step 2: method stubs.
|
| +static jint Method(JNIEnv* env, jobject obj,
|
| + jint nativeTest,
|
| + jint arg1) {
|
| + Test* native = reinterpret_cast<Test*>(nativeTest);
|
| + DCHECK_NATIVE_PTR(native, "Method", 0);
|
| + return native->Method(env, obj, arg1);
|
| +}
|
| +
|
| +namespace {
|
| +
|
| +static void testMethodWithParam(JNIEnv* env, jobject obj, jint iParam) {
|
| + env->CallVoidMethod(obj,
|
| + g_Test_testMethodWithParam, iParam);
|
| +
|
| +}
|
| +
|
| +static jint testStaticMethodWithParam(JNIEnv* env, jint iParam) {
|
| + jint ret = env->CallStaticIntMethod(g_Test_clazz,
|
| + g_Test_testStaticMethodWithParam, iParam);
|
| + return ret;
|
| +}
|
| +
|
| +static jdouble testMethodWithNoParam(JNIEnv* env) {
|
| + jdouble ret = env->CallStaticDoubleMethod(g_Test_clazz,
|
| + g_Test_testMethodWithNoParam);
|
| + return ret;
|
| +}
|
| +
|
| +static base::android::ScopedJavaLocalRef<jstring>
|
| + testStaticMethodWithNoParam(JNIEnv* env) {
|
| + jstring ret = static_cast<jstring>(env->CallStaticObjectMethod(g_Test_clazz,
|
| + g_Test_testStaticMethodWithNoParam));
|
| + return base::android::ScopedJavaLocalRef<jstring>(env, ret);
|
| +}
|
| +} // namespace
|
| +
|
| +// Step 3: RegisterNatives.
|
| +
|
| +static const JNINativeMethod kMethodsTest[] = {
|
| + { "nativeMethod",
|
| +"("
|
| +"I"
|
| +"I"
|
| +")"
|
| +"I", reinterpret_cast<void*>(Method) },
|
| +};
|
| +
|
| +static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) {
|
| + g_Test_clazz = static_cast<jclass>(env->NewWeakGlobalRef(clazz));
|
| +
|
| + const int kMethodsTestSize = arraysize(kMethodsTest);
|
| +
|
| + if (env->RegisterNatives(g_Test_clazz,
|
| + kMethodsTest,
|
| + kMethodsTestSize) < 0) {
|
| + jni_generator::HandleRegistrationError(
|
| + env, g_Test_clazz, __FILE__);
|
| + return false;
|
| + }
|
| +
|
| + g_Test_testMethodWithParam = env->GetMethodID(
|
| + g_Test_clazz,
|
| + "testMethodWithParam",
|
| +"("
|
| +"I"
|
| +")"
|
| +"V");
|
| + if (g_Test_testMethodWithParam == NULL) {
|
| + return false;
|
| + }
|
| +
|
| + g_Test_testStaticMethodWithParam = env->GetStaticMethodID(
|
| + g_Test_clazz,
|
| + "testStaticMethodWithParam",
|
| +"("
|
| +"I"
|
| +")"
|
| +"I");
|
| + if (g_Test_testStaticMethodWithParam == NULL) {
|
| + return false;
|
| + }
|
| +
|
| + g_Test_testMethodWithNoParam = env->GetStaticMethodID(
|
| + g_Test_clazz,
|
| + "testMethodWithNoParam",
|
| +"("
|
| +")"
|
| +"D");
|
| + if (g_Test_testMethodWithNoParam == NULL) {
|
| + return false;
|
| + }
|
| +
|
| + g_Test_testStaticMethodWithNoParam = env->GetStaticMethodID(
|
| + g_Test_clazz,
|
| + "testStaticMethodWithNoParam",
|
| +"("
|
| +")"
|
| +"Ljava/lang/String;");
|
| + if (g_Test_testStaticMethodWithNoParam == NULL) {
|
| + return false;
|
| + }
|
| +
|
| + return true;
|
| +}
|
| +
|
| +extern "C" JNIEXPORT bool JNICALL
|
| +Java_org_chromium_example_jni_generator_Test_initNativeClass(JNIEnv* env, jclass
|
| + clazz) {
|
| + return RegisterNativesImpl(env, clazz);
|
| +}
|
| +
|
| +#endif // org_chromium_example_jni_generator_Test_JNI
|
|
|