| Index: base/android/jni_generator/golden_sample_for_tests_jni.h
|
| diff --git a/base/android/jni_generator/golden_sample_for_tests_jni.h b/base/android/jni_generator/golden_sample_for_tests_jni.h
|
| index b90bb9fe310cc39dd5f6a5000e5f122fe64e44e7..7b936f341b2fba0812017d4f3169cfe641db6250 100644
|
| --- a/base/android/jni_generator/golden_sample_for_tests_jni.h
|
| +++ b/base/android/jni_generator/golden_sample_for_tests_jni.h
|
| @@ -33,18 +33,36 @@ jclass g_InnerStructB_clazz = NULL;
|
|
|
| namespace base {
|
| namespace android {
|
| +extern "C"{
|
|
|
| static jlong Init(JNIEnv* env, jobject jcaller,
|
| jstring param);
|
| +__attribute__((alias("Init"), visibility("default"))) jlong
|
| + Java_org_chromium_example_jni_1generator_SampleForTests_nativeInit(JNIEnv*
|
| + env, jobject jcaller,
|
| + jstring param);
|
|
|
| static jdouble GetDoubleFunction(JNIEnv* env, jobject jcaller);
|
| +__attribute__((alias("GetDoubleFunction"), visibility("default"))) jdouble
|
| +Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetDoubleFunction(JNIEnv*
|
| + env, jobject jcaller);
|
|
|
| static jfloat GetFloatFunction(JNIEnv* env, jclass jcaller);
|
| +__attribute__((alias("GetFloatFunction"), visibility("default"))) jfloat
|
| +Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetFloatFunction(JNIEnv*
|
| + env, jclass jcaller);
|
|
|
| static void SetNonPODDatatype(JNIEnv* env, jobject jcaller,
|
| jobject rect);
|
| +__attribute__((alias("SetNonPODDatatype"), visibility("default"))) void
|
| +Java_org_chromium_example_jni_1generator_SampleForTests_nativeSetNonPODDatatype(JNIEnv*
|
| + env, jobject jcaller,
|
| + jobject rect);
|
|
|
| static jobject GetNonPODDatatype(JNIEnv* env, jobject jcaller);
|
| +__attribute__((alias("GetNonPODDatatype"), visibility("default"))) jobject
|
| +Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatatype(JNIEnv*
|
| + env, jobject jcaller);
|
|
|
| // Step 2: method stubs.
|
| static void Destroy(JNIEnv* env, jobject jcaller,
|
| @@ -53,6 +71,12 @@ static void Destroy(JNIEnv* env, jobject jcaller,
|
| CHECK_NATIVE_PTR(env, jcaller, native, "Destroy");
|
| return native->Destroy(env, jcaller);
|
| }
|
| +__attribute__((alias("Destroy"), visibility("default")))
|
| + void
|
| + Java_org_chromium_example_jni_1generator_SampleForTests_nativeDestroy(JNIEnv*
|
| + env,
|
| + jobject jcaller,
|
| + jlong nativeCPPClass);
|
|
|
| static jint Method(JNIEnv* env, jobject jcaller,
|
| jlong nativeCPPClass) {
|
| @@ -60,6 +84,12 @@ static jint Method(JNIEnv* env, jobject jcaller,
|
| CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0);
|
| return native->Method(env, jcaller);
|
| }
|
| +__attribute__((alias("Method"), visibility("default")))
|
| + jint
|
| + Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv*
|
| + env,
|
| + jobject jcaller,
|
| + jlong nativeCPPClass);
|
|
|
| static jdouble MethodOtherP0(JNIEnv* env, jobject jcaller,
|
| jlong nativePtr) {
|
| @@ -68,6 +98,12 @@ static jdouble MethodOtherP0(JNIEnv* env, jobject jcaller,
|
| CHECK_NATIVE_PTR(env, jcaller, native, "MethodOtherP0", 0);
|
| return native->MethodOtherP0(env, jcaller);
|
| }
|
| +__attribute__((alias("MethodOtherP0"), visibility("default")))
|
| + jdouble
|
| + Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethodOtherP0(JNIEnv*
|
| + env,
|
| + jobject jcaller,
|
| + jlong nativePtr);
|
|
|
| static void AddStructB(JNIEnv* env, jobject jcaller,
|
| jlong nativeCPPClass,
|
| @@ -76,6 +112,13 @@ static void AddStructB(JNIEnv* env, jobject jcaller,
|
| CHECK_NATIVE_PTR(env, jcaller, native, "AddStructB");
|
| return native->AddStructB(env, jcaller, b);
|
| }
|
| +__attribute__((alias("AddStructB"), visibility("default")))
|
| + void
|
| + Java_org_chromium_example_jni_1generator_SampleForTests_nativeAddStructB(JNIEnv*
|
| + env,
|
| + jobject jcaller,
|
| + jlong nativeCPPClass,
|
| + jobject b);
|
|
|
| static void IterateAndDoSomethingWithStructB(JNIEnv* env, jobject jcaller,
|
| jlong nativeCPPClass) {
|
| @@ -83,6 +126,13 @@ static void IterateAndDoSomethingWithStructB(JNIEnv* env, jobject jcaller,
|
| CHECK_NATIVE_PTR(env, jcaller, native, "IterateAndDoSomethingWithStructB");
|
| return native->IterateAndDoSomethingWithStructB(env, jcaller);
|
| }
|
| +__attribute__((alias("IterateAndDoSomethingWithStructB"),
|
| + visibility("default")))
|
| + void
|
| + Java_org_chromium_example_jni_1generator_SampleForTests_nativeIterateAndDoSomethingWithStructB(JNIEnv*
|
| + env,
|
| + jobject jcaller,
|
| + jlong nativeCPPClass);
|
|
|
| static jstring ReturnAString(JNIEnv* env, jobject jcaller,
|
| jlong nativeCPPClass) {
|
| @@ -90,6 +140,12 @@ static jstring ReturnAString(JNIEnv* env, jobject jcaller,
|
| CHECK_NATIVE_PTR(env, jcaller, native, "ReturnAString", NULL);
|
| return native->ReturnAString(env, jcaller).Release();
|
| }
|
| +__attribute__((alias("ReturnAString"), visibility("default")))
|
| + jstring
|
| + Java_org_chromium_example_jni_1generator_SampleForTests_nativeReturnAString(JNIEnv*
|
| + env,
|
| + jobject jcaller,
|
| + jlong nativeCPPClass);
|
|
|
| static base::subtle::AtomicWord g_SampleForTests_javaMethod = 0;
|
| static jint Java_SampleForTests_javaMethod(JNIEnv* env, jobject obj, jint foo,
|
| @@ -307,65 +363,9 @@ static base::android::ScopedJavaLocalRef<jstring>
|
| jni_generator::CheckException(env);
|
| return base::android::ScopedJavaLocalRef<jstring>(env, ret);
|
| }
|
| -
|
| -// Step 3: RegisterNatives.
|
| -
|
| -static const JNINativeMethod kMethodsSampleForTests[] = {
|
| - { "nativeInit",
|
| -"("
|
| -"Ljava/lang/String;"
|
| -")"
|
| -"J", reinterpret_cast<void*>(Init) },
|
| - { "nativeDestroy",
|
| -"("
|
| -"J"
|
| -")"
|
| -"V", reinterpret_cast<void*>(Destroy) },
|
| - { "nativeGetDoubleFunction",
|
| -"("
|
| -")"
|
| -"D", reinterpret_cast<void*>(GetDoubleFunction) },
|
| - { "nativeGetFloatFunction",
|
| -"("
|
| -")"
|
| -"F", reinterpret_cast<void*>(GetFloatFunction) },
|
| - { "nativeSetNonPODDatatype",
|
| -"("
|
| -"Landroid/graphics/Rect;"
|
| -")"
|
| -"V", reinterpret_cast<void*>(SetNonPODDatatype) },
|
| - { "nativeGetNonPODDatatype",
|
| -"("
|
| -")"
|
| -"Ljava/lang/Object;", reinterpret_cast<void*>(GetNonPODDatatype) },
|
| - { "nativeMethod",
|
| -"("
|
| -"J"
|
| -")"
|
| -"I", reinterpret_cast<void*>(Method) },
|
| - { "nativeMethodOtherP0",
|
| -"("
|
| -"J"
|
| -")"
|
| -"D", reinterpret_cast<void*>(MethodOtherP0) },
|
| - { "nativeAddStructB",
|
| -"("
|
| -"J"
|
| -"Lorg/chromium/example/jni_generator/SampleForTests$InnerStructB;"
|
| -")"
|
| -"V", reinterpret_cast<void*>(AddStructB) },
|
| - { "nativeIterateAndDoSomethingWithStructB",
|
| -"("
|
| -"J"
|
| -")"
|
| -"V", reinterpret_cast<void*>(IterateAndDoSomethingWithStructB) },
|
| - { "nativeReturnAString",
|
| -"("
|
| -"J"
|
| -")"
|
| -"Ljava/lang/String;", reinterpret_cast<void*>(ReturnAString) },
|
| };
|
|
|
| +// Step 3: RegisterNatives.
|
| static bool RegisterNativesImpl(JNIEnv* env) {
|
| g_InnerStructA_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
|
| base::android::GetClass(env, kInnerStructAClassPath).obj()));
|
| @@ -374,16 +374,6 @@ static bool RegisterNativesImpl(JNIEnv* env) {
|
| g_InnerStructB_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
|
| base::android::GetClass(env, kInnerStructBClassPath).obj()));
|
|
|
| - const int kMethodsSampleForTestsSize = arraysize(kMethodsSampleForTests);
|
| -
|
| - if (env->RegisterNatives(g_SampleForTests_clazz,
|
| - kMethodsSampleForTests,
|
| - kMethodsSampleForTestsSize) < 0) {
|
| - jni_generator::HandleRegistrationError(
|
| - env, g_SampleForTests_clazz, __FILE__);
|
| - return false;
|
| - }
|
| -
|
| return true;
|
| }
|
|
|
|
|