Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: base/android/jni_generator/testNativeExportsOption.golden

Issue 147533004: Remove unneeded JNI registrations. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Fix exports in non-JNI shared libs. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/android/jni_generator/jni_generator_tests.py ('k') | build/android/android_exports.lst » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/jni_generator/testNativeExportsOption.golden
diff --git a/base/android/jni_generator/testNativeExportsOption.golden b/base/android/jni_generator/testNativeExportsOption.golden
new file mode 100644
index 0000000000000000000000000000000000000000..4d206bd9d63ab40080edd099a3fc72ed45f9d08c
--- /dev/null
+++ b/base/android/jni_generator/testNativeExportsOption.golden
@@ -0,0 +1,216 @@
+// 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/SampleForTests
+
+#ifndef org_chromium_example_jni_generator_SampleForTests_JNI
+#define org_chromium_example_jni_generator_SampleForTests_JNI
+
+#include <jni.h>
+
+#include "base/android/jni_generator/jni_generator_helper.h"
+
+#include "base/android/jni_int_wrapper.h"
+
+// Step 1: forward declarations.
+namespace {
+const char kSampleForTestsClassPath[] =
+ "org/chromium/example/jni_generator/SampleForTests";
+// Leaking this jclass as we cannot use LazyInstance from some threads.
+jclass g_SampleForTests_clazz = NULL;
+
+} // namespace
+
+extern "C" {
+
+static jint Init(JNIEnv* env, jobject jcaller);
+
+__attribute__((visibility("default")))
+jint
+ Java_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_nativeInit(JNIEnv*
+ env, jobject jcaller) {
+ return Init(env, jcaller);
+}
+
+static jint Init(JNIEnv* env, jobject jcaller);
+
+__attribute__((visibility("default")))
+jint
+ Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_nativeInit(JNIEnv*
+ env, jobject jcaller) {
+ return Init(env, jcaller);
+}
+
+}; // extern "C"
+
+// Step 2: method stubs.
+
+extern "C" {
+__attribute__((visibility("default")))
+jint
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeStaticMethod(JNIEnv*
+ env,
+ jobject jcaller,
+ jlong nativeTest,
+ jint arg1) {
+ Test* native = reinterpret_cast<Test*>(nativeTest);
+ CHECK_NATIVE_PTR(env, jcaller, native, "StaticMethod", 0);
+ return native->StaticMethod(env, jcaller, arg1);
+}
+
+__attribute__((visibility("default")))
+jint
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv*
+ env,
+ jobject jcaller,
+ jlong nativeTest,
+ jint arg1) {
+ Test* native = reinterpret_cast<Test*>(nativeTest);
+ CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0);
+ return native->Method(env, jcaller, arg1);
+}
+
+static base::subtle::AtomicWord g_SampleForTests_testMethodWithParam = 0;
+static void Java_SampleForTests_testMethodWithParam(JNIEnv* env, jobject obj,
+ JniIntWrapper iParam) {
+ /* Must call RegisterNativesImpl() */
+ CHECK_CLAZZ(env, obj,
+ g_SampleForTests_clazz);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_INSTANCE>(
+ env, g_SampleForTests_clazz,
+ "testMethodWithParam",
+
+"("
+"I"
+")"
+"V",
+ &g_SampleForTests_testMethodWithParam);
+
+ env->CallVoidMethod(obj,
+ method_id, as_jint(iParam));
+ jni_generator::CheckException(env);
+
+}
+
+static base::subtle::AtomicWord g_SampleForTests_testMethodWithParamAndReturn =
+ 0;
+static base::android::ScopedJavaLocalRef<jstring>
+ Java_SampleForTests_testMethodWithParamAndReturn(JNIEnv* env, jobject obj,
+ JniIntWrapper iParam) {
+ /* Must call RegisterNativesImpl() */
+ CHECK_CLAZZ(env, obj,
+ g_SampleForTests_clazz, NULL);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_INSTANCE>(
+ env, g_SampleForTests_clazz,
+ "testMethodWithParamAndReturn",
+
+"("
+"I"
+")"
+"Ljava/lang/String;",
+ &g_SampleForTests_testMethodWithParamAndReturn);
+
+ jstring ret =
+ static_cast<jstring>(env->CallObjectMethod(obj,
+ method_id, as_jint(iParam)));
+ jni_generator::CheckException(env);
+ return base::android::ScopedJavaLocalRef<jstring>(env, ret);
+}
+
+static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithParam = 0;
+static jint Java_SampleForTests_testStaticMethodWithParam(JNIEnv* env,
+ JniIntWrapper iParam) {
+ /* Must call RegisterNativesImpl() */
+ CHECK_CLAZZ(env, g_SampleForTests_clazz,
+ g_SampleForTests_clazz, 0);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_STATIC>(
+ env, g_SampleForTests_clazz,
+ "testStaticMethodWithParam",
+
+"("
+"I"
+")"
+"I",
+ &g_SampleForTests_testStaticMethodWithParam);
+
+ jint ret =
+ env->CallStaticIntMethod(g_SampleForTests_clazz,
+ method_id, as_jint(iParam));
+ jni_generator::CheckException(env);
+ return ret;
+}
+
+static base::subtle::AtomicWord g_SampleForTests_testMethodWithNoParam = 0;
+static jdouble Java_SampleForTests_testMethodWithNoParam(JNIEnv* env) {
+ /* Must call RegisterNativesImpl() */
+ CHECK_CLAZZ(env, g_SampleForTests_clazz,
+ g_SampleForTests_clazz, 0);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_STATIC>(
+ env, g_SampleForTests_clazz,
+ "testMethodWithNoParam",
+
+"("
+")"
+"D",
+ &g_SampleForTests_testMethodWithNoParam);
+
+ jdouble ret =
+ env->CallStaticDoubleMethod(g_SampleForTests_clazz,
+ method_id);
+ jni_generator::CheckException(env);
+ return ret;
+}
+
+static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithNoParam =
+ 0;
+static base::android::ScopedJavaLocalRef<jstring>
+ Java_SampleForTests_testStaticMethodWithNoParam(JNIEnv* env) {
+ /* Must call RegisterNativesImpl() */
+ CHECK_CLAZZ(env, g_SampleForTests_clazz,
+ g_SampleForTests_clazz, NULL);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_STATIC>(
+ env, g_SampleForTests_clazz,
+ "testStaticMethodWithNoParam",
+
+"("
+")"
+"Ljava/lang/String;",
+ &g_SampleForTests_testStaticMethodWithNoParam);
+
+ jstring ret =
+ static_cast<jstring>(env->CallStaticObjectMethod(g_SampleForTests_clazz,
+ method_id));
+ jni_generator::CheckException(env);
+ return base::android::ScopedJavaLocalRef<jstring>(env, ret);
+}
+}; // extern "C"
+
+// Step 3: RegisterNatives.
+
+static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) {
+ g_SampleForTests_clazz = static_cast<jclass>(env->NewWeakGlobalRef(clazz));
+
+ return true;
+}
+
+extern "C" JNIEXPORT bool JNICALL
+Java_org_chromium_example_jni_1generator_SampleForTests_nativeInitNativeClass(JNIEnv*
+ env, jclass clazz) {
+ return RegisterNativesImpl(env, clazz);
+}
+
+#endif // org_chromium_example_jni_generator_SampleForTests_JNI
« no previous file with comments | « base/android/jni_generator/jni_generator_tests.py ('k') | build/android/android_exports.lst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698