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

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: Rebaes, added native_exports switch, don't remove empty RegisterNatives. Created 6 years, 8 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
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..c2e505c65fde65a7a1d5e9f6984d95783433b017
--- /dev/null
+++ b/base/android/jni_generator/testNativeExportsOption.golden
@@ -0,0 +1,146 @@
+// 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;
+
+} // namespace
+
+// Step 2: method stubs.
+
+extern "C" {
+static jint Method(JNIEnv* env, jobject jcaller,
bulach 2014/04/14 13:16:02 shouldn't this method name start with Java_org_chr
ostap 2014/04/15 23:30:20 No, here it is as it defined in native code.
+ jlong nativeTest,
+ jint arg1) {
+ Test* native = reinterpret_cast<Test*>(nativeTest);
+ CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0);
+ return native->Method(env, jcaller, arg1);
+}
+
+__attribute__((alias("Method"), visibility("default")))
+ jint Java_org_chromium_example_jni_1generator_Test_nativeMethod(JNIEnv* env,
bulach 2014/04/14 13:16:02 what's up with "1"generator? also: if I'm understa
ostap 2014/04/15 23:30:20 The class is org/chromium/example/jni_generator/Te
+ jobject jcaller,
+ jlong nativeTest,
+ jint arg1);
+
+static base::subtle::AtomicWord g_Test_testMethodWithParam = 0;
+static void Java_Test_testMethodWithParam(JNIEnv* env, jobject obj, jint iParam)
+ {
+ /* Must call RegisterNativesImpl() */
+ CHECK_CLAZZ(env, obj,
+ g_Test_clazz);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_INSTANCE>(
+ env, g_Test_clazz,
+ "testMethodWithParam",
+
+"("
+"I"
+")"
+"V",
+ &g_Test_testMethodWithParam);
+
+ env->CallVoidMethod(obj,
+ method_id, iParam);
+ jni_generator::CheckException(env);
+
+}
+
+static base::subtle::AtomicWord g_Test_testStaticMethodWithParam = 0;
+static jint Java_Test_testStaticMethodWithParam(JNIEnv* env, jint iParam) {
+ /* Must call RegisterNativesImpl() */
+ CHECK_CLAZZ(env, g_Test_clazz,
+ g_Test_clazz, 0);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_STATIC>(
+ env, g_Test_clazz,
+ "testStaticMethodWithParam",
+
+"("
+"I"
+")"
+"I",
+ &g_Test_testStaticMethodWithParam);
+
+ jint ret =
+ env->CallStaticIntMethod(g_Test_clazz,
+ method_id, iParam);
+ jni_generator::CheckException(env);
+ return ret;
+}
+
+static base::subtle::AtomicWord g_Test_testMethodWithNoParam = 0;
+static jdouble Java_Test_testMethodWithNoParam(JNIEnv* env) {
+ /* Must call RegisterNativesImpl() */
+ CHECK_CLAZZ(env, g_Test_clazz,
+ g_Test_clazz, 0);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_STATIC>(
+ env, g_Test_clazz,
+ "testMethodWithNoParam",
+
+"("
+")"
+"D",
+ &g_Test_testMethodWithNoParam);
+
+ jdouble ret =
+ env->CallStaticDoubleMethod(g_Test_clazz,
+ method_id);
+ jni_generator::CheckException(env);
+ return ret;
+}
+
+static base::subtle::AtomicWord g_Test_testStaticMethodWithNoParam = 0;
+static base::android::ScopedJavaLocalRef<jstring>
+ Java_Test_testStaticMethodWithNoParam(JNIEnv* env) {
+ /* Must call RegisterNativesImpl() */
+ CHECK_CLAZZ(env, g_Test_clazz,
+ g_Test_clazz, NULL);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_STATIC>(
+ env, g_Test_clazz,
+ "testStaticMethodWithNoParam",
+
+"("
+")"
+"Ljava/lang/String;",
+ &g_Test_testStaticMethodWithNoParam);
+
+ jstring ret =
+ static_cast<jstring>(env->CallStaticObjectMethod(g_Test_clazz,
+ method_id));
+ jni_generator::CheckException(env);
+ return base::android::ScopedJavaLocalRef<jstring>(env, ret);
+}
+};
+
+// Step 3: RegisterNatives.
+
+static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) {
+ g_Test_clazz = static_cast<jclass>(env->NewWeakGlobalRef(clazz));
+
+ return true;
+}
+
+#endif // org_chromium_example_jni_generator_Test_JNI

Powered by Google App Engine
This is Rietveld 408576698